1
0
-1

Hi guys,

I am currently on v6 beta and working on something with the JSON POST Plugin.

It looks like the https post request goes out properly and that I get a response from the server.
However, the response fields are not stored and I get this error no matter what:

ERROR 14 Apr 2017 17:15:20 org.joget.plugin.property.service.PropertyUtil - Missing value at character 1
org.json.JSONException: Missing value at character 1
at org.json.JSONTokener.syntaxError(JSONTokener.java:496)
at org.json.JSONTokener.nextValue(JSONTokener.java:404)
at org.json.JSONObject.<init>(JSONObject.java:191)
at org.json.JSONObject.<init>(JSONObject.java:403)
at org.joget.plugin.property.service.PropertyUtil.getPropertiesValueFromJson(PropertyUtil.java:74)
at org.joget.JsonPostTool.execute(JsonPostTool.java:123)
at org.joget.apps.app.service.AppWorkflowHelper.executeTool(AppWorkflowHelper.java:124)
at org.joget.workflow.shark.WorkflowToolActivityHandler.executeActivity(WorkflowToolActivityHandler.java:69)
)

This is the response from the server when testing the POST request in another tool:

{
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdXRob3JpemF0aW9uIjozMTg5MTE1NTMyNTA0",
"token_type": "bearer",
"expires_in": 3600,
"data": {
"id": 2063343322,
"name": "Eric",
"email": "Eric@sdfcsd.de"
},
"refresh_token": "0/d45tdfxbgdfgdndfg03fa1efaa59"
}

 Config:

 

Any ideas what the problem might be?

    CommentAdd your comment...

    3 answers

    1.  
      2
      1
      0

      I just re-tried calling some of these APIs with the new JSON Tool (Joget 6 Beta2) and it looks like this works now.Haven't finished testing all of them but I'll mark this as resolved since the error this thread was about does no longer occur.

      Great job - thanks guys!

        CommentAdd your comment...
      1.  
        1
        0
        -1

        Hi guys,

        I did further testing and found the following problems:

        When I pass all the parameters in the url in the POST Tool it seems that the request reaches the server. Because if I test it a second time in another tool (Postman) then I get "code already used"for a one-off code.
        When I pass the parameters under "parameters"in the POST Tool then the request doesn't seem to reach the server.

        Secondly, the same error as outlined above exists in both instances. I simply cannot get the data back into Joget - something seems to go wrong when the response is parsed (response definately starts with  "{" as outlined above.

        Could you please test wherever the tool works for you guys with HTTPS requests?

        Cheers,

        Eric

        1. Eric

          Curious: The JSON Post Tool works with the OAuth slack API all the way through. It doesn't work with the Asana Token endpoint or to make a call against the Dropbox API with Authorization through a Bearer token (both OAuth flows). Julian Anders, any ideas what could go wrong? The exact same requests work in Postman. Might be a CORS or pre-flight issue?

        CommentAdd your comment...
      2.  
        1
        0
        -1

        The error message pretty much tells you what went wrong. The returned message that it received as a result of its call simply did not start with the curly bracket "{". If the first character is not a curly bracket, then it is deemed that it is not a JSON object it expected thus it stopped processing.

        You will need to check with the provider of the call you are making to. Make sure that it whitelist your Joget Workflow domain if there's such feature in place for them and/or you are making the correct call with the necessary parameters/payload expected by the provider.

        1. Eric

          Thanks Walter - that's what I thought but the response should start with "{" (even errors come back in standard json objects). I know through testing the same POST call with another tool that the response always starts with "{". It is somewhat hard to track because I cannot see the actual POST call that Joget assembles from the different hash variables - any tip on how I would be able to see what Joget actually sends out? I am using escaped (?url) form hash variables - is it possible that something goes wrong when they are replaced?

        CommentAdd your comment...