How to add array parameters on Postman client? - postman

I am using Postman client for Mac. I am trying to use Buffer API to update my Buffer account's schedules. The API endpoint refers to usage of these parameters:
POST Data
schedules[0][days][]=mon&
schedules[0][days][]=tue&
schedules[0][days][]=thu&
schedules[0][times][]=12:45&
schedules[0][times][]=15:30&
schedules[0][times][]=17:43&
But, when I use on Postman, or Insomnia Mac client, it does not update my Buffer account. It shows up as success on the API request response. But, the Buffer schedules are not updated.
What is the right way to insert array parameters in Postman?

Related

Using local API endpoint for message processor issue

I'm trying to create a retry mechanism which will be recall my API (using POST method) in case of error (for example HTTP 400)
For this reason, I've created an In Memory Message Store. If my REST call is failed, I send the message to the message store that I created.
Then I tried to create an endpoint which is the same API URL (Scheduled Message Forwarding Processor will be used that) in WSO2 Management Console UI:
, but I've got the following error when I click the Test button:
Interesting thing is I can access the API with Postman or through my application but, WSO2 itself cannot access the API which is available on it.
I realized that when I click the test button, WSO2 adds ?wsdl at the end of the endpoint that I try and only available GET APIs can be recalled by message processor with this method but my API using POST method, and I need to recall it.
I'm using WSO EI 6.4.0
Thanks for any idea!
Regards.
For connection to REST API, you should use HTTP Endpoint, not the Address Endpoint
.
But you may consider extracting the logic you want from your API into a sequence and using the Message Sampling Processor to push messages to that sequence rather than your own REST API. This could be a more efficient solution.

Postman- Pass dynamic parameters to collection at run-time which is not part of response

I have created postman collection for unit testing of APIs.
I need to handle below scenario.
My second API generates OTP and sends it over email but its not part of response.
I want to pass that OTP in request body of 3rd API.
I am executing postman collection using Collection Runner.
Is there any way I can pause the execution and set this environment variable and then resume.
Or any other better option. Please suggest.
There is a way to do it but it require some knowledge of server side technologies ( for example Spring boot). you can create a new api which is kind of wrapper over your OTP api and it will read the OTP from either your mail/DB and send it as a part of Http response and then you can use that wrapper API in your Postman collection to fetch the OTP and then save it as a env variable and use it in further apis. I am also doing the same way.

Amazon Gateway - access original request body in integration response

Good day everyone, my problem related with Amazon Gateway API. I have the following case:
Response received from 3rd party service and contains no query params (all necessary data stored in body)
I'am able to modify body and pass it to target URL via Integration Request
Integration Request finished, i receive some data from target endpoint
Now i need to create Integration Response, based on original data (received in 1.) and data, received from target endpoint.
Problem appears at stage 4. I can't find a way to access original body here ($input.body contains response from target endpoint, there is no original data).
I also tried to store necessary data in scope variables ($input/$context), but it seems like AWS Gateway allows only to read it.
As of now, you cannot access the $input.body in the integration response mapping. We will consider supporting this in the future.

Getting binary response or method not allowed. When tried setting only http endpoint I never got response its just keeping processing for long time

I am using wso2 1.10.0 api manager for first time. I need to access the http backend with simple query parameter. I published the api and tried either by setting as queryparam or json object, it's not giving me the expected result. I will get binary response or method not allowed. When tried setting only http endpoint I never got response its just keeping processing for long time. Please suggest me how do I access simple http backend. Need to show demo in a week.
Please help to solve this.
You get 'method not allowed' when you try to access a resource which was not defined for that method (say backend has POST method supporting resource only and you try to do a GET request)
I guess the issue is with the way you have defined the resources for the api from the publisher application. (invalid HTTP methods for resources)
If you think you have defined them correctly, then the next step to identify the issue is wirelogs. wirelogs provide all the info in request passing through the api manager gateway (request headers, body etc)
Follow this article http://mytecheye.blogspot.com/2013/09/wso2-esb-all-about-wire-logs.html on how to enable and read them
You can then directly call the backend (say curl -v to the backend) and compare the request from the direct call vs the one going out from
gateway to the backend and check the difference. This would help you start finding the issue
Since you are new to API manager, I would recommend you to do following first
Try out a simple scenario similar to your one. You can google it. This is from official documentation. would recommend to try out a simple scenario first. say https://docs.wso2.com/display/AM1100/Convert+a+JSON+Message+to+SOAP+and+SOAP+to+JSON
Then use SOAP UI or similar app to directly call the backend web service (not the api manager) and get the SOAP request and SOAP response for the backend.
Then create the api in API manager. you need to do the same thing in the sample i provided. only difference is the soap payload. use the previously collected SOAP messages.
Enable wire logs. for that see the comments in the previous answer. In wirelogs you will see >> and << signs
To read the wire log, first we have to identify message direction.
DEBUG - wire >> - This represent the message coming into API manager from the wire (will notice two set of these. one coming in to the
gateway from the rest client and response coming in to the api manager from the backend. )
DEBUG - wire << - This represents the message going to the wire from API manager (again two sets. request going from api manager to the
backend service and the response sent to the rest client from the api manager.)
the soap message will be printed in this log. check for the request going from api manager to the backend and the response coming from the
backend to the api manager. you can compare that to the onces you collected in the step 2 and do modifications if needed to the sequnces.
the wirelogs will also print the http headers. so check that as well.
hope you could set up a working sample using these steps

HTTP request method with no data

I have a REST endpoint in my application that takes no data and returns no data.
The endpoint is clearing out some data I previously stored in the user's session. I don't need to send or receive data from the client -- just hit the endpoint.
I currently allow the endpoint to only receive HTTP POST requests.
Is there a better HTTP request method than POST for this scenario? If so why?
I think this is actually fine. POST doesn't necessarily need to create a resource. If it's modifying the client's session, it's ok in my book. For the return code, consider 204/No content.
The endpoint is not actually ReSTful. Clearing out session data means your aren't transferring state on each request, see If REST applications are supposed to be stateless, how do you manage sessions?