I call api Patch , update the value field from is null to input value, reponse 200 OK, but the value doesn't change

Hi Sebastian,

I have…

I add new field id.iv to shema, auto set value is null.
I call api Patch update the value field from is null to input value, reponse 200 OK, but the value doesn’t change and does not have history when load back page web
Patch: {url}//api/content/{app}/{shema-name}/e54582ed-e600-4d75-86b5-53b48673ee67
Body json:
{
“id”: {
“iv”: “e54582ed-e600-4d75-86b5-53b48673ee67”
}
}
Reponse: 200 OK

Can you help me explain where I went wrong?
Hoping to receive a reply from you!
Best regards!

You cannot change the ID of a content item. You have to create a new one.

That’s right.
But the ID field I’m wanting to edit is a new field (data.id.iv). I create it in the content of the shema. This field ID is string data type like other fields like field name, phone,…etc. These fields I can change. My action is saves the ID of the item in this new Id of content field.

Then it looks okay. And you are sure that the request is correct and not wrapped inside another object or so?

I can be sure I didn’t wrapped in any object.
Because, if I create a new content and the field data.id.iv value is a string, I call the api Patch field with the new value and I get the result I want.

I just added a test to the test suite that runs with every commit on the API to verify your case and I cannot find an issue. I need a full example / code to find the problem.

Thank you very much.
I found the cause. I created the field Id and insert value for it, then I accidentally deleted that field and recreated the insert value as it was before deleting, the json already has the same value so it doesn’t update the status

1 Like