CURLSMBS Post body question

Hi all

I am sending a post request using CURLSMBS to get back some accounting data.

I suspect the post body, which contains the request info which is in ‘msData’, is not being sent.

This is the code I’m using.

Is ‘c.OptionPostFields = msData’ the right way to handle it?

Full code…

	using xojo.core
	Dim c as new CURLSMBS
	dim msData As String
	msData = DefineEncoding(psBody, Encodings.ASCII)
	Dim requestHeaders(2) as String
	requestHeaders(0) = "Content-Type = application/json"
	requestHeaders(1) = "Ocp-Apim-Subscription-Key: " + Session.oscAccountingSystem.sCas_SubscriptionKeyPrimary
	requestHeaders(2) = "Authorization: Bearer " + Session.oscAccountingSystem.sCas_AccessToken
	c.SetOptionHTTPHeader requestHeaders
	c.CollectOutputData = True
	c.OptionSSLVerifyPeer = 0
	c.OptionFollowLocation = true
	c.OptionSSLVerifyHost = 0
	c.OptionPost = true
	c.OptionURL = URL
	c.OptionPostFields = msData
	Dim performInt as Integer = c.Perform

Thanks for your help


requestHeaders(0) = "Content-Type = application/json"

please use a : there, so this must be:

requestHeaders(0) = "Content-Type: application/json"

c.OptionPostFields is right for input JSON data.

Thanks Christian as usual your on the money…

PS I’m hoping to make to your conference.

Great. You are welcome to join us!