Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
cpjamloki
Visitor

Re:post json data

thanks Roku, But problem occuring here:

param={"abcd":{"isDevice":false,"soapRequest":{"contractAcceptanceMedium":"WEB"}},"searchCustomerProfileRestRequest":{"soapRequest":{"customerSearch":{"address":{"streetAddress1":"UgRnJhbmtsaW4gU3Q=","unitNumber":"NzY0Mg==","zipCode":"MjMyMTk="},"sessionId":""}}},"selectCustomerProfileRestRequest":{"soapRequest":{"sessionId":"","searchSelectionChoice":{}}},"queryBadDebtRestRequest":{"soapRequest":{"sessionId":"","firstName":null,"lastName":null,"emailAddress":null,"socialSecurityNumber":null,"telephoneNumber":null,"creditCheckConsent":false},"dateOfBirth":null}}


when i use :

url.AsyncPostFromString(param)


---->it gives me syntax error in param why? what is wrong in param here.?

if i am not wrong param should be in completely string form here.
According to you
you can post JSON data using AsyncPostFromString(string)
but it does't allow me post my json data here as a parameter. giving syntax error in param.

and Please share an example where we are sending JSON as part of a post request.

Thanks
CPJamloki
0 Kudos
RokuMarkn
Visitor

Re: Getting HTTP response code 400

Since you won't post the code and the error message as I previously asked, we can only guess, but it seems that you are passing an AssociativeArray to AsyncPostFromString. It needs to be a string, not an AA, as you yourself said in your last post. An AA is not a string. This code should work. Note that the first line is necessary since "null" is not a reserved word in Brightscript, as RokuKC already told you earlier.


null = invalid

param={"abcd":{"isDevice":false,"soapRequest":{"contractAcceptanceMedium":"WEB"}},"searchCustomerProfileRestRequest":{"soapRequest":{"customerSearch":{"address":{"streetAddress1":"UgRnJhbmtsaW4gU3Q=","unitNumber":"NzY0Mg==","zipCode":"MjMyMTk="},"sessionId":""}}},"selectCustomerProfileRestRequest":{"soapRequest":{"sessionId":"","searchSelectionChoice":{}}},"queryBadDebtRestRequest":{"soapRequest":{"sessionId":"","firstName":null,"lastName":null,"emailAddress":null,"socialSecurityNumber":null,"telephoneNumber":null,"creditCheckConsent":false},"dateOfBirth":null}}

param_string = FormatJSON(param)

url.AsyncPostFromString(param_string)


If you are still having problems, please POST THE ERROR MESSAGE that you are seeing.

--Mark
0 Kudos
cpjamloki
Visitor

Re: Getting HTTP response code 400

Hi Mark,
i have send you private message regarding this on forum, please find it. here you can see :
Error generating by debug console:

*** ERROR compiling /pkg:/source/services.brs:
Syntax Error. (compile error &h02) in pkg:/source/services.brs(14)


Thanks
0 Kudos
TheEndless
Channel Surfer

Re: Getting HTTP response code 400

@RokuMarkn, doesn't that AA syntax require the 7.x firmware? I suspect that's the source of cpjamloki's syntax error.
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
0 Kudos
RokuMarkn
Visitor

Re: Getting HTTP response code 400

Yes, I realized that and sent him a PM about it.

--Mark
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.