How to send the post request in wso2 api manager? What would be the content type, parameters etc.
I am publishing Rest APIs in WSO2 API Manager , I would like to intercept my own API input field validations for each API like input parameter format and value etc. If validation success then API Manager should allow the request to invoke back-end , else reject the request with error message.
You can create a custom handler or custom sequence and deploy it for that api. You can implement the validation logic inside that.
see following product documentation
https://docs.wso2.com/display/AM1100/Writing+Custom+Handlers
https://docs.wso2.com/display/AM1100/Adding+Mediation+Extensions
Related
Please suggest the possible techniques to validate(NULL, NOT NULL, TAG presence, length, etc.) incoming request JSON schema elements in API Manager before backend service is invoked.
Is it recommended to perform schema level validation in WSO2 API Manager?
As per my knowledge, schema validations(XML/JSON) should be done at client side before API deployed on API Manager in invoked.
Any comments would be appreciated.
Regards,
Abhishek
In order to validate the request json you can use OpenAPI validation specifications. apim facilitates you to edit the OpernAPI spec from the UI it self.
As per my knowledge you can do the validation in both places, but if you do the validation in the client it self you can prevent the API invocation to api manager.
I created an api in wso2 api manager 2.0 publisher. When I publish this api, I have some resource /Some/things In the wso2 store. If I keep the case as is in the URL, then my api works. If I use any other tool to call and change the case in url to then I get a 202 error.
I know the WSO2 API Manager is handling the API URL correctly but i want to disable these feature.
how can i do this??
There is no option to disable case-sensitive in api manager. But you can rewrite the request url by any reverse proxy and send the request to apim.
e.g nginx url redirect[1]
[1] https://www.nginx.com/blog/creating-nginx-rewrite-rules/
I am using WSO2 API Gateway to service API calls. The backend requires custom user attributes (username, e-mail, etc.) to be sent as part of the query string in the URL. The values for the query string pairs will be provided in the SAML2 token embedded in the API call.
How can a mediator access these custom SAML2 attributes?
You can create a custom mediator or custom handler to parse the saml token and set it to a header or something . see Writing Custom+Handlers for sample handler which reads a header .
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
I'm trying to integrate payment gateway with wso2 api manager.I'm following wso2 documentation. According to this documentation "If you need to redirect back to the API Manager, call the workflow call back service to complete the workflow. To invoke this service, set the callback URL and the workflow reference ID in the additional parameters"
what exactly is the call back url here. and how to make subscription complete after payment is successfull. i.e to call complete method??
Callback URL is a link which will be invoked by API method after its work is done. Here callback url is the additional parameter according to the API documentation. You need to set this field with the page where you want to redirect your client after payment.