setDataField REST API `value` parameter - Forum - Rollbase - Progress Community

setDataField REST API `value` parameter

 Forum

setDataField REST API `value` parameter

This question is answered

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

Verified Answer
  • 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
  • With template text field, do you mean a 'Template' field like below?

  • 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.

  • 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>"