franco pina
franco pina

Reputation: 333

Pass parameters to WSO2 AM background api

I am implementing WSO2 AM and I have some doubts. I want to implement a api gateway for all the services that I currently have.

(if you think there are easier open-source gateway api to implement it would also help)

the endpoints are in NodeJS with express. They have the following format:

http://localhost:3000/x/x1/:param1/:param2

http://localhost:3000/x/x2/:param1/:param2/:param3

My idea is to create a wn wso2 AP api with an endpoint that has the following format:

https://localhost:3000/x/

The api generated in the wso2 would be:

http://localhost:3000/x

and then as a resource get add x1 and the other parameters, the problem is that I don't know how to add the x1 and the parameters so that the end point is

http://localhost:3000/x/x1/:param1/:param2

Upvotes: 0

Views: 85

Answers (1)

menaka_
menaka_

Reputation: 1100

In API Manager, here is how the API getting exposed.

You have the backend service with the following context and resource pattern.

http://localhost:3000/{context}/{resource}/{params...}

http://localhost:3000/x/x1/...

http://localhost:3000/x/x2/...

The resources should be added with the same name as the backend service.

{VERB} x1/{param1}/{param2}

The path parameters should be provided in the above format.

The backend endpoint for this API should be provided as follows.

http://localhost:3000/x/

When invoking the api, the gateway will append the resource and the parameters to the backend endpoint.

https://localhost:8243/xapi/1.0.0/x1/param1/param2 ==> http://localhost:3000/x/x1/param1/param2

Upvotes: 1

Related Questions