setDataField REST API `value` parameter

Posted by troynguyen on 28-Aug-2018 10:22

I'm trying to use the setDataField REST API to programmatically update a template text field on the Settings object. This API is documented here: https://documentation.progress.com/output/rb/doc/index.html#page/rb%2Fsetdatafield.html%23

Are there any examples of what the `value` parameter is supposed to be? The documentation states "Value to be set. Must be formatted the same way as values in spreadsheet imports. For File Upload fields: Base-64 encoded binary value of file."

Right now I'm POST-ing to the end point with a JSON string containing information similar to the DataField container in the server-side API:

'{"name": "some_integration_name", "value": "new template text value"}'

Making this request with a valid session ID, object ID, and field integration name gives me a 200 OK stating that the field has been updated, when it reality it has not. Does anyone know why this could be? I'm assuming I'm not formatting the value parameter properly

Posted by Ruben Dröge on 29-Aug-2018 02:29

If it is a template field, what is it that you're trying to do? Do you want to change the template of this template field?

In that case, you should use the updateFieldDef REST Metadata Method. And to know what you need to use as input values there, you better first use the getFieldDef method.

Note: The template itself has to be converted to a binary64 encoded value.

Note2: Don't try to add the XML as an URL parameter like the documentation suggests. Please send it in the body of the request.

All Replies

Posted by Ruben Dröge on 29-Aug-2018 02:04

With template text field, do you mean a 'Template' field like below?

Posted by Ruben Dröge on 29-Aug-2018 02:29

If it is a template field, what is it that you're trying to do? Do you want to change the template of this template field?

In that case, you should use the updateFieldDef REST Metadata Method. And to know what you need to use as input values there, you better first use the getFieldDef method.

Note: The template itself has to be converted to a binary64 encoded value.

Note2: Don't try to add the XML as an URL parameter like the documentation suggests. Please send it in the body of the request.

Posted by troynguyen on 29-Aug-2018 12:07

Hey Ruben,

This worked perfectly. I struggled for a bit because I was trying to send the XML DataFieldDef node as a JSON object:

{ xmlString: "<DataFieldDef>...</DataFieldDef>" }

Instead, the body is expecting text/plain: "DataFieldDef>...</DataFieldDef>"

This thread is closed