I'm a bit lost with the HTTPPost2 function. According to the documentation, the fifth parameter is:
used to contain string representation for the status of the HTTP request, such as OK.
But this isn't the case. It returns a rowset. I'd really like to find out what the field names that are used in the rowset are, so I can view their values.
I note that depending on the URL I use for my POST request, the number of rows in the rowset changes.
Does anyone have any ideas what field values are used?
Sample Request
%%[
var @payload, @postRequest, @response, @responseRows
set @payload = '{
"Order Number":10110113,
"First Name":"Simon",
"Last Name":"Sausage",
"Amount":{
"Order Subtotal":120,
"VAT":20,
"Shipping":0,
"Order Total":120
}
}'
set @postrequest = HTTPPost2("https://httpbin.org/post","application/json", @payload, true, @response, @responseRows)
]%%
status code: %%=v(@postrequest)=%%
response: %%=v(@response)=%%
responseRows: %%=v(@responseRows)=%%
responseRowCount: %%=RowCount(@responseRows)=%%
Sample Output
The request returns the status code, response payload and rowset.
The following response has been abbreviated for display purposes.
status code: 200
response: {"args":{}, "data":"{...}", "files":{}, "form":{ }, "headers":{...}, "json":{"Amount":{"Order Subtotal":120, "Order Total":120, "Shipping":0, "VAT":20 }, "First Name":"Simon", "Last Name":"Sausage", "Order Number":10110113 } }
responseRows: System.Data.DataRow[]
responseRowCount: 10