Updating Salesforce object with WSO2 Rest API Connector - wso2

I'm try to update Account object in Salesforce with the use of WSO2 salesforce rest API connector.as per the documentation is as follow
<salesforcerest.update>
<sObjectName>{$ctx:sObjectName}</sObjectName>
<fieldAndValue>{$ctx:fieldAndValue}</fieldAndValue>
<Id>{$ctx:Id}</Id>
</salesforcerest.update>
does anyone have an idea what should be the format fieldAndValue.
I have tried giving the attribute tag and the value.But it fails.

Haven't used the Rest API so far (only soap), but it looks to me like you have to pass attribut:value to salesforce.
Salesforce doku
According to the wso2 docu I would try it like to pass a json like this.
wso2 docu
"fieldAndValue": {
"name": "wso2",
"description":"This Account belongs to WSO2"
}
or the values inside the like this.
{
"name": "wso2",
"description":"This Account belongs to WSO2"
}
Hope that helps.

Related

AWS Cognito - Create a user via API Endpoint in Postman

Does anybody know if I can make a request to create or a sign up a user in AWS Cognito user pool?
For example, something like below is to display the login screen.
But is there a POST request or endpoint I can call to create a user?
I tried looking through their documentation but no look finding anything concrete.
Keep in mind, if it possible I would like to populate a value for a custom attribute I created.
This is the main reason why I am looking for an endpoint because I cannot seem to find a way to populate the value for a custom attribute via the AWS interface.
So technically I do not need an endpoint if it is possible to populate a custom attribute per user in AWS.
GET https://mydomain.auth.us-east-1.amazoncognito.com/login?
response_type=code&
client_id=ad398u21ijw3s9w3939&
redirect_uri=https://YOUR_APP/redirect_uri&
state=STATE&
scope=openid+profile+aws.cognito.signin.user.admin
It looks like what you need is https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminCreateUser.html or https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_SignUp.html. As far as I'm aware, there is no way to prepopulate the attribute on the Cognito hosted UI. You did not specify what programming language you are using, but at the bottom of the page there are links to documentation with examples for different SDKs. The difference between these two approaches is discussed here: https://docs.aws.amazon.com/cognito/latest/developerguide/signing-up-users-in-your-app.html. So in this case, AdminCreateUser corresponds to option 3 and SignUp to option 1. The difference is mainly in whether or not the user will receive an invite. Also, for AdminCreateUser Cognito will generate a temporary password and require user to enter a new password the first time they log in.
Body
{
"ClientId": "test",
"Password": "Qwerty123",
"UserAttributes": [
{
"Name": "email",
"Value": "test#test.com"
}
],
"Username": "test#test.com"
}
Headers
URL
POST https://cognito-idp.eu-west-1.amazonaws.com/ HTTP/1.1

Schema validation in WSO2 API manager version 3.0 against openAPI specification

I am new to WSO2. We are trying to implement WSO2 api manager for our project. So I have downloaded wso2 api manager 3.0 and started to explore it. In that I have seen schema validation option and then referred the documentation of it. According to that I have added schema definition in my API as per Open API specification (v3.0). But after enabling the schema definition, it doesn't seem to validate the request against the schema defined. Is there anything that I am doing wrong? Please provide any any information related to this.
JSON schema validation in WSO2 api manager 3.0 documentation:
https://apim.docs.wso2.com/en/latest/Learn/APISecurity/APIRequestResponseSchemaValidation/json-schema-validator/
If you have provided a valid request payload/parameters or if the response you get is according to the schema you have provided you won't get any special notifications to indicate that the values have passed through the schema validation. If the req/response payload does not adhere to the schema, then you will get the error message.
Did you get any error message? Also, share your OpenAPI schema definition to see whether that has some issues.

WSO2 EI REST API Manager Resource

I need to manage a Registry Resource deployed into the Enterprise Integrator.
Using the REST API like this:
https://localhost:9443/registry/resource/_system/governance/EstrattoContoEnti/xml/EstrattoContoEntiConf.xml
I can GET the resource, but...how can I modify this or create a new one?
Calling a PUT o POST I get Error 405 - Method Not Allowed.
Is there any API to manage the registry entries on the WSO2 EI?
Or may I need to use something else?
This is not possible out of the box via a REST API.
There is a AdminService for Registry and you may access that AdminService and get the related functionality via SOAP.
But in your case, since you are expecting a REST API, you can create a web-app client which will use this Admin-service, so that you have a REST API to the registry via this client.
There is already such a client written. Have a look at the steps on how to get this and configured from the following blog.
http://abeykoon.blogspot.com/2015/04/wso2-gov-registry-using-registry-api.html
Cheers.

WSO2 Rest Api -> How to add user to role?

I'm creating a "Developer Portal" to my org where a user will be able to self-register and create apps to consume public APIs. These public API are being marked by a custom role.
Everything is working 99% fine. The user can self register, create apps, generate keys, subscribe to API and etc... the 1% that's missing is this "assignment" of the "PublicAPI" role!
Looking around the web I found this article here which shows exactly what I intend to do, but it uses SOAP, and I would like to know if there's a way to use a REST request to do so?
You can achieve it via SCIM2 APIs where you can assign users to roles/groups. You can perform PATCH operation for group endpoint as described here [1].
Sample payload as below,
{
"schemas": [
"urn:ietf:params:scim:api:messages:2.0:PatchOp"
],
"Operations": [
{
"op": "add",
"value": {
"members": [
{
"display": "user",
"$ref": "https://localhost:9443/scim2/Users/a39fe03c-8d57-4b4c-a69d-5160c2384bea",
"value": "a39fe03c-8d57-4b4c-a69d-ddddddd"
}
]
}
}
]
}
[1] https://docs.wso2.com/display/IS570/apidocs/SCIM2-endpoints/#!/operations#GroupsEndpoint#patchGroup
There is not REST API implementation out of the box for the functionalities you are requiring.
At the moment, what you are doing is invoking the Admin-service related to your function via a SOAP message. These Admin-Services are OSGI services that are invokable via SOAP requests.
If you need to access those via REST API, you have to create a JAX-RS based webapp (Not a complex task) which would consume the OSGi Service. So that you can access the Webapp via REST-API and the webapp will consume the OSGi Service and get the functionality done for you.
I wold highly recommend you to go ahead and create a webapp since it is not a complex task as it sounds.
You can find a web-app build for RegistryAdminService (where the webapp consume the OSGi service related to RegistryAdmin) in the link [1].
To a complete guide including a sample code on creating such a web-app, you can refer the following link [2].
[1] - https://github.com/abeykoon/Blog-Resources
[2] - https://wso2.com/library/articles/2016/10/article-exposing-wso2-identity-server-admin-services-the-rest-way/
Cheers!

WSO2 APIM : Get API Rating and Business Information through Store REST API

I have a custom page where I obtain Published API list using WSO2 Store Restful API
https://docs.wso2.com/display/AM220/apidocs/store/#!/operations#APICollection#apisGet
The problem is the returned result does not includes API Rating and Business Information whereas the Jaggery API that has been used by the default API Manager UI does include it. Is there any way to configure it so the REST API returns that data?
If I use the jaggery API instead, it is cookie based while I am using OAuth2 OIDC Service Provider of the IS. I cant obtain API that has visibility to only its own domain by passing access token to the Authorization header.
APIM Version: 2.2
Please Advice. Thanks!
There is no such a way which will change the output response of defined APIs.
If you want to do that, get source code of wso2 from github & edit the APIs & use the edited source to deploy your application. (But this will add lots of maintenance issue)
The quickest way is to call the get details of api.
It will return the business information object as well as below:
"businessInformation": {
"technicalOwner": "John Doe",
"technicalOwnerEmail": "architecture#pizzashack.com",
"businessOwner": "Jane Roe",
"businessOwnerEmail": "marketing#pizzashack.com"
},
Here you will get the heavy response as it returns the complete swagger definition as well.