DoPost JSON
Posted: Thu May 12, 2022 1:20 am
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.
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.