VBCS exposes its business objects as Rest APIs to get, post, patch, delete etc .
These APIs can be used by basic authentication of using IDCS user.
Business object and its API in VBCS:
The API format will be like:
https://(yourOICinstance)-integration.ocp.oraclecloud.com/ic/builder/design/XXDashboardPOC/1.0.1/resources/data/{VBCS Business object}
Example":
https://dev-abcCompany.integration.ocp.oraclecloud.com/ic/builder/design/XXDashboardPOC/1.0.1/resources/data/IntegrationStatusTable
We can test this from POSTMAN:
Now let us see an example with query parameter:
To use this in OIC we need to create a connection with REST adapter:
The endpoint call for a business object will be normal from OIC if we do not have any query parameter(For eg. fetching full data).
If we have query parameter then we need to do it little bit differently from the ones we do in OIC usually for query parameter.
In OIC we usually define query parameters separately like below:
Then in the mapper we will look like below :
Now if we save and run the integration we will get Error:
If we expand the Fault paylod and observe the following highlighted in yellow in the below screenshot with the one we passed in POSTMAN we can find out the issue:
We can see that just after the '?' we have field name and values, there is no 'q' in the query parameter.
This is the reason it is failing. It is expecting format like '?q=fieldname=value'.
So to correct this we should create a single query parameter and concat all these in one query string and send.
Also we need to keep in mind one fore thing that all the values for fields should be enclosed in quote because they are string and VBCS Api expects them in quote.
Lets see the API call from VBCS itself before seeing the screenshots from OIC rest adapter configuration.
We can see in the above screenshot that it gave bad request when we didn't give value in quote.
Now lets give the value in quote:
We can see that after giving value in quote , it gave a successful response.
This was the reason we had used the values for fields inquote when we tried with POSTMAN.
Now lets got to OIC rest adapter configuration:
Create the query parameter as below:
Copy the response from VBCS successful API response and use as response in our OIC response format:
Now in the mapper map all values for fields and enclose the values in quote.
The sample concatenation will be like below for multiple query parameters:
concat ("moduleID='", /nssrcmpr:execute/nssrcmpr:QueryParameters/ns21:Module, "' and integrationCode='", /nssrcmpr:execute/nssrcmpr:QueryParameters/ns21:IntegrationCode, "' and createdBy='", $self/nsmpr0:metadata/nsmpr0:runtime/nsmpr0:invokedBy, "'" )
Now lets save and run the integration.
We can see in below screenshot that the integration succeeded this time:
Now lets verify the request and response payloads for VBCS rest Api call:
Request payload:
Response Payload:
In the next post we will see how we can upload a file in VBCS app and send it to an OIC integration.
No comments:
Post a Comment