Hello all,
I am trying to execute this command :
#U_Request.DoPost( #HTTPpost ).
Unhappily we got respond code 401 back in the LANSA function .
Maybe there are some solutions to resolve this ?
Thanks
Twan Fréhé
Some source code :
Define_Com Class(#XPRIM_Json) Name(#json)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonObj) Reference(*DYNAMIC)
Define_Com Class(#XPRIM_JsonObject) Name(#jsonpartijObj) Reference(*DYNAMIC)
* make root of JSON document
#jsonObj <= #json.CreateRootObject
* add Bearer token
* Value of token is get from another DoPost with right value!
#u_Request.Options.AddBearerAuthorization( #u_Token )
* archive
#jsonObj.SerializeToFile Path(#PATHNAMDOC) --> A archive document is set to the drive with right JSON lines without Bearer
* place JSON to content
#u_Request.Content.AddJson Value(#json)
* sent to URL
#U_Request.DoPost( #HTTPpost )
Checking respond after DoPost is code 401 Authorization.
DoPost JSON
Re: DoPost JSON
quick suggestion, enable the tracing (viewtopic.php?f=3&t=2605&p=7702&hilit=lansaxlib#p7702) so you can see if the request is built correctly and the exact response you are getting. Maybe something is missing that you need to populate to get a successful post.