[SalesForce] Need help with HTTPPost call in ampscript

I have the following code

SET @CallStatus = ''
set @JSON = HTTPPost("http://someapi/bgcenter/","application/json","a=getSubLists&m=10790742&o=j&e=sometest@email.com", @CallStatus)

I am trying to save this in a microsite, but it is not letting me giving me back a Forbidden 403 error. I assume It is because of the someapi (which I have changed for this demo), but I am unclear as to how to get this post to work. The urls for our webservice works, and gives us back JSON code, and HTTPPost and HTTPPost2 both seem to allow me to make this call, but I am unclear about the documentation without an example:

S3 The content to post to the specified URL S4 The output
parameter used to contain returned HTTP status code from the HTTP POST
request S5 Name of any additional headers to add to the HTTP POST
request S6 Value of any additional headers to add to the HTTP POST
request

So should I put my variables into a content string, or should I be adding them to the additional headers? And how do I get a POST to work to an outside third party webservice?

Best Answer

It appears that HTTPPost and HTTPPost2 both return a status and not the actual data response from the post. So we used HTTPGet instead and passed the parameters through the url. This is a hack if anyone has a better solution using post, please let me know.

Related Topic