Just as the title suggests.
I want to wrap a database call in an API or REST API whichever is easiest preferable API Manager API.
How can i do this and return the data from the database in json?
You can use DSS to access the database, and then a payload factory mediator or Data Mapper to transform the response in a json.
Alternatively, you can use DSS to expose your data as a set of REST style resource.Take a look at this link for an example on how to achieve this.
Related
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.
New to WSO2 EI,
I have built an API that will give a response JSON, i want to parse and save this in Database. How can I do this.
Db is external Oracle, for which I have a JNDI built already.
~Jawa
There are multiple ways of achieving this,either you can perform entire things in ESB or you can use DSS as well.
Once you get JSON response you need to frame a query, you can use DB mediator add insert query which would then insert into DB.
Else you can create a data service in DSS and then pass this JSON, write a insert query in DSS and insert it into DB.
For DB mediator check this link
https://docs.wso2.com/display/ESB490/DB+Report+Mediator
For Data service check below link.
https://docs.wso2.com/display/DSS322/Exposing+Data+as+REST+Resources
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 have an internal webservice exposed in SOAP/HTTP. What I am trying to achieve using API manager is to expose my internal SOAP based webservice over different protocols like XML, JSON etc.
Does WSO2 API manager have that capability.
Thanks and Regards
Privin Thomas
If you wish to transform the incoming message into a different format for the backend. This can be done using the underlying ESB capabilities of the API Manager - there are actualy several ways. IMHO, the easiest way to do this is with Mediation Extensions. For information on adding a Mediation Extension to an API, please see the documentation here:
https://docs.wso2.com/display/AM170/Adding+Mediation+Extensions
I am trying to filter JSON results coming from our main application in our WSO2 API Manager and to filter URL's in the results. I haven't tried anything specific. Any ideas?
In Filter mediator use xpath to identify the certain messages/properties.check the url in the payload and filter..Check the documenation