Jack
Jack

Reputation: 1606

Can't make PUT /raylight/v1/documents/id/parameter/id work properly

I need to update document parameters via REST API.

I've tried using the following:

PUT .../raylight/v1/documents/33903/parameters/3

with the following json payload

{
    "parameters":{
        "parameter": {
            "id": 3,
            "answer": {
                "values": {
                    "value": [
                        "2019/9"
                    ]
                }
            }
        }
    }
}

But the returned answer shows unmodified parameters:

{
    "parameter": {
        "@optional": "false",
        "@type": "prompt",
        ...
        "id": 3,
        ...
        "answer": {
            ...
            "info": {
                ...
                "previous": {
                    "value": [
                        "2015\/12"
                    ]
                }
            },
            "values": {
                "value": [
                    "2015\/12"
                ]
            }
        }
    }
}

How can I properly set new prompt parameters?

Upvotes: 0

Views: 59

Answers (1)

Joe
Joe

Reputation: 6827

Do:
PUT .../raylight/v1/documents/33903/parameters

instead of:
PUT .../raylight/v1/documents/33903/parameters/3

Adding a parameter ID at the end performs a different function: it returns the list of parameters that are dependent upon the one provided. You have only one in this case, and it's returning itself. Leave it off, to refresh the document.

Upvotes: 2

Related Questions