hieulm
hieulm

Reputation: 29

Add authentication to an existed API using WSO2 AM

I have created an API using WSO2 EI that looks like https://localhost:8243/services/ABC.

Then I want to create another API that gets above API as the endpoint in order to add authentication. So how can I pass value to URL pattern and endpoint to get that?

When URL pattern is /xyz, and the endpoint is https://localhost:8243/services/ABC. It points to https://localhost:8243/services/ABC/xyz that not my endpoint.

Thank you so much!

Upvotes: 0

Views: 62

Answers (2)

Pubci
Pubci

Reputation: 4001

You can attach a custom sequence to the API.

<sequence xmlns="http://ws.apache.org/ns/synapse" name="header_sequence">

   <property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
       
</sequence>

This drops the resources and not appending to the path.

Please refer - https://apim.docs.wso2.com/en/latest/deploy-and-publish/deploy-on-gateway/api-gateway/message-mediation/mapping-the-parameters-of-your-backend-urls-with-the-api-publisher-urls/#mapping-the-parameters-of-your-backend-urls-with-the-api-publisher-urls

Upvotes: 2

As per my understanding, you are trying to invoke the backend https://localhost:8243/services/ABC via the API created in APIM. You can try out the following to achieve it,

In the API created in APIM, you can simply add the URL https://localhost:8243/services as the endpoint and then create a resource path as /ABC.

Upvotes: 1

Related Questions