AnsweredAssumed Answered

data api and json parameters

Question asked by darrenburgess on May 16, 2018
Latest reply on May 18, 2018 by darrenburgess

Looks like there may be an issue with the dataapi/json functions that may make in not possible to execute an api request that runs a script with a parameter.

see this discussion:

https://community.filemaker.com/message/763572?commentID=763572&et=watches.email.thread#comment-763572

 

The API documentation suggests that we can pass a script and script.param property in the JSON payload for a CREATE.  The JSON would look something like this:

{

  "fieldData" :

  {

  "item" : "thing",

  "manufacturer" : "apple"

  },

  "script.param" : "some param",

  "script" : "postRequestScript"

}

 

Note however that when attempt to create a JSON object that has a property with a dot (script.param) the JSONSetElement function returns an error:

 

JSONSetElement ( "" ;

  [ "fieldData" ; "{}" ; JSONObject ] ;

  [ "script" ; "someScriptName" ; JSONString ] ;

  [ "script.param" ; "some parameter value" ; JSONString ]

)

 

Error:  ? in Json::Value::resolveReference(key, end): requires objectValue

 

Unless we can somehow overcome this issue, we may have to construct the JSON with string concatenation.

Outcomes