creating an API proxy for post request

Not applicable

Hello, I am unable to understand how to pass data to a proxy with POST method. Could you please explain the whole process of creating an API proxy with method as POST and also how to call this proxy while passing the relevant data or you could redirect me to an explanation if it already exists...

Thanks

Solved Solved
0 5 6,350
1 ACCEPTED SOLUTION

sidd-harth
Participant V

Hi @Avisha Jindal, create a proxy as mentioned by Dino. Then you are ready to make a POST call.

Once the proxy is deployed, copy the Deployment URL from overview page.

6607-overview.jpg

Use a Rest Client such as Postman or use cURL to make a POST call.

Below Image is from Postman.

6608-postman.jpg

View solution in original post

5 REPLIES 5

By default, an Apigee Edge API Proxy will allow a POST request. API Proxies configured in Apigee Edge are reverse proxies, that accept any verb, any header, any payload, any URI. Using the "New Proxy Wizard" in the Apigee Edge UI, if you....

  1. click + Proxy
  2. select Reverse Proxy
  3. specifying a name and base path and a target
  4. select "pass through" for security
  5. select the defaults for vhost and environment

...you will have an API Proxy that accepts POST requests.

By configuring the API proxy further, you can restrict the verbs, headers, paths, or combinations of those, so that the API proxy will return a 400 or etc status code when it receives a combination that you would like to reject.

For example you could configure the API Proxy to always send back a 400 code if the inbound request is not a POST. You could configure the API Proxy to always send back a 415 code if the inbound request does not bear a Content-type header containing "application/json".

Does this help?

Thanks for your prompt response.

I'm still unable to understand how to pass a complicated JSON string as part of the proxy request. (For ex - { "data": { "accountDetails": [ { "account": 100, "accountType": "S", "nomineeInfo": [ { "nomineeEmail": "ryft@gft.vbn", "nomineeId": "GHGHH244" }, { "nomineeEmail": "", "nomineeId": "" } ] } ], "primaryApplicantDetail": { "customerCIF": "", "dateStarted": "" }, "rmId": "ABC" } })

"how to pass a JSON string" - from which client?

from curl you just do this:

curl -i https://myendpoint/foobar -H content-type:application/json -d '{ "data" : "foo"...}' 

This has nothing to do with Apigee Edge.

If Apigee Edge has a passthrough proxy, that JSON payload will be "passed through" to the backend. You don't need to do anything to cause this to happen. The payload is passed through unless you configure it to do otherwise.

I think you are perhaps lacking some understanding about how a reverse proxy works.

Maybe read up on the basics?

Thanks!!! Actually i was wondering this only that how can JSON be passed through configuration in APIGEE... now i understand that we'll have to use some external way only to pass JSON.

sidd-harth
Participant V

Hi @Avisha Jindal, create a proxy as mentioned by Dino. Then you are ready to make a POST call.

Once the proxy is deployed, copy the Deployment URL from overview page.

6607-overview.jpg

Use a Rest Client such as Postman or use cURL to make a POST call.

Below Image is from Postman.

6608-postman.jpg