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

Time:01-14

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?

CodePudding user response:

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.

  • Related