wso2 esb json post method blank query parameter handling - json

I converted JSON (client) to SOAP (back end) through ESB Proxy Service and it is working fine.
URL "https://someurl.com/json/"
The problem is that I am trying to call from another batch process application (Mirth) and it is adding "?" end of the URL changing the URL to "https://someurl.com/json?" How can I get rid of the "?" character?

This article contains information on how to customize URLs.
This is also possible using Script mediator - these can also be used for URL transformations.

Related

Retrieve values from a nested response in Postman

I am using postman to get certain responses. Below is my response.
Here I have some other api request links integrated with this response. Is there any possibility that I can get values inside these apis also. Its like retrieve values forom both parent api request and child api request.
I know this is possible using a java code. But is there any other exsiting software that I can use for this?
In your case I would recommend combining multiple requests into a chain or even a workflow. The idea is to have the first request fetch href endpoints that get called in subsequent requests. For that, the initial request needs a post-request test script that reads the href values from the response and stores it in a environment or global variable.
Like so:
// persist project href for next request
pm.environment.set("projectUrlPath", pm.response.json().embedded.elements[0]._links.project.href);
Your next request in the line would than use this variable to build the request url. Like so:
http://www.example.com{{projectUrlPath}}
The key is to correctly navigate to the right attribute in the response json JavaScript object. This online tool might help you with that:
https://www.w3schools.com/js/tryit.asp?filename=tryjs_json_parse

Call rest service that returns JSON in mule esb?

How to call a rest service that returns JSON in a APIKit based message flow. I want to prepare the request for Rest service and want to extract the JSON message in a message flow.
Can any one help me to do this?
Thanks
The recommended way to invoke/consume REST services in mule is the use of HTTP Request
Do let us know if there is a specific you are facing
The request connector is especially handy when consuming a RESTful API
that is described in a RAML file. If you reference the API's RAML file
in the connector's configuration, it will proactively offer you the
set of available resources and operations contained in the RAML file,
as well as enforce the policies described in the file. It will also
expose the API metadata to Studio, which can then be used by other
elements such as DataWeave to autocomplete fields and make
configuration much easier
Use Rest URI path to invoke the Service and you can also get json response as output based on the type of service you invoke

Google OAuth - Incorrect JSON while Validating Access Token

I'm getting an access token from the Android SDK which I'm sending to the server. On the server side, I'm calling the following API to validate my token:
https://www.googleapis.com/oauth2/v1/tokeninfo?access_token=<token here>
From Google, I'm getting the following response (partial response added):
{\"statusCode\":200,\"body\":\"{n \"issued_to\":
\"407408718192.apps.googleusercontent.com\",n \"audience\":
\"407408718192.apps.googleusercontent.com\",n \"user_id\":
\"110586055381870434283\",n \"scope\":
\"https://www.googleapis.com/auth/plus.login
https://www.googleapis.com/auth/plus.me"}
Unfortunately, this JSON is not parseable because of the backslashes & i'm not able to validate the token identity.
Is this a problem with the Google API or do I need to apply any regex?
Google sends back proper JSON without the slashes, being exactly the part that's inside the "body" element of the output that you paste (well without the slashes).
So your Node.js HTTP client is wrapping it with the HTTP status code element and puts in the slashes as well, so your clients need convert back from that on its own.

WSo2 API Manager 1.8.0 - JSON parsing issue

I am new to wso2 API Manager, trying to set it up expose my plain HTTP POST back end calls as a REST API. I am sure this is not a new pattern that I am trying to achieve here. The requirement is to convert the JSON data coming in (has array structures) into the HTTP URL query string parameters.
After some research through the documentation and other posts on this forum, decided to go with the script mediator that would parse the JSON data and convert it to a string that can be appended to the endpoint URL. Some how I am not able to achieve this.
I have followed the following post that seems to be very straight forward. As the original poster suggested, I am also not able to use getPayloadJSON() method. Even have trouble using the work around suggested there due to JSON.parse() not working.
Link
Also, this approach of editing the service bus configuration from source view does not sound like the correct option. Is there another elegant solution to achieve this? Thanks for the help in advance.
I was able to get both methods working by using an external script instead of the inline java script. Thanks

What is the URL for alfresco CMIS 1.1 queries

I'm trying to figure out how to use the new browser binding in Alfresco 4.2. I get that the service URL is
https://server.com/alfresco/api/-default-/public/cmis/versions/1.1/browser
And I'm able to do requests for objects and paths in a restful manner
https://server.com/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/Sites
https://server.com/alfresco/api/-default-/public/cmis/versions/1.1/browser?objectId=xxx
But what I don't understand is how to translate the specification's "selectors" and "actions" into URLs. For instance, I have no idea what the URL for doing a "query" is.
http://docs.oasis-open.org/cmis/CMIS/v1.1/cs01/CMIS-v1.1-cs01.html#x1-5540003
I've tried all of these to no avail:
https://server.com/alfresco/api/-default-/public/cmis/versions/1.1/browser/doQuery?q=select ...
https://server.com/alfresco/api/-default-/public/cmis/versions/1.1/browser/root/doQuery?q=select ...
https://server.com/alfresco/api/-default-/public/cmis/versions/1.1/browser?cmisaction=query&statement=select....
https://server.com/alfresco/api/-default-/public/cmis/versions/1.1/browser/cmisselector=query&q=select...
I think I'm having trouble reading the specification. The specification lists out a bunch of "selector" and "actions" for named URLS (service url, repository url, object url, etc). But doesn't explain how those are to be formed into URL strings.
You can execute a query with HTTP GET and HTTP POST.
A HTTP GET URL end with: .../browser?cmisselector=query&q=select...
For A HTTP POST example see:
http://docs.oasis-open.org/cmis/CMIS/v1.1/os/examples/browser/doQuery-request.log