How to add API with POST method

Imported Google Group message. Original thread at: Redirecting to Google Groups Import Date: 2016-01-19 21:18:55 +0000.
Sender:tam vu.
Date:Wednesday, 29 July 2015 10:36:26 UTC+1.

Hi Guys,

I’m new bie on Tyk. I have just download Tyk 1.7 and Dashboard 0.9.5 and i have installed successful.

But when I add API on dashboard, i cann’t define POST method.

example :

Tyk server run on : http://192.168.241.128:8080

target API (POST method) : http://10.84.5.79:9091/send_test

and when i add API in API management on Dashboard, i have URL API : http://192.168.241.128:8080/6ada4b81796c40bf67b89d787ee0f611

But when I try to POST to : http://192.168.241.128:8080/6ada4b81796c40bf67b89d787ee0f611

Target server only log GET method.

anybody help me create API with POST method ?

thanks!

Imported Google Group message.
Sender:Martin Buhr.
Date:Wednesday, 29 July 2015 10:59:42 UTC+1.

Hi,

Tyk 1.7 has trouble with “one-to-one” maps like you have defined, in the next version this bug is fixed, I would suggest you use the following set up:

Target URL: http://10.84.5.79:9091/
Test URL: POST http://192.168.241.128:8080/6ada4b81796c40bf67b89d787ee0f611/send_test

This will work.

If your endpoint can handle an appended slash (http://10.84.5.79:9091/send_test/) then you could use:

Target URL: http://10.84.5.79:9091/send_test
Test URL: POST http://192.168.241.128:8080/6ada4b81796c40bf67b89d787ee0f611/

The reason it is not working for you at the moment is because you need to add a slash tot the end of your request (see the test URL above). The appended slash for the target is a bug we found recently that causes a slash to allways be added to the end of a URL even if the inbound routing URL path portion is empty. This will be fixed in 1.8 though. In the meantime, I would suggest using the first setup I mentioned.

Thanks,
Maritn

Imported Google Group message.
Sender:tam vu.
Date:Wednesday, 29 July 2015 11:21:27 UTC+1.

thank for support Martin !

many Target URL do not handle slash at the end of URL. so i think with the first solution of you is good.

But, if you fire out pretty Test URL :slight_smile: i think better.

example :

Target URL: http://10.84.5.79:9091/send_test
Test URL: POST http://192.168.241.128:8080/6ada4b81796c40bf67b89d787ee0f611

hope fixed version release as soon as.

thanks!

  • show quoted text -


IM : vmintam
Skype : vmintam
Phone : (+84)936315768
Email : [email protected]