BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JeanDo
Obsidian | Level 7

Hi everybody,

I try to edit an internal entity in VI 10.5 with this request (I'm using postman):

 

curl -X PUT \
https://<tenant-name>/svi-datahub/documents/test_modification/8ce7a94a-576f-4a93-9332-825afb52ad68 \
-H 'Accept: application/json' \
-H 'Authorization: Bearer <access_token' \
-H 'Connection: keep-alive' \
-H 'Content-Type: application/json' \
-H 'X-CSRF-TOKEN: ebd81d8d-2b98-4d70-a7d0-361781a6264d' \
-d '{"objectTypeId": 120819,"objectTypeName": "test_modification","objectTypeVersion":12,"id": "8ce7a94a-576f-4a93-9332-825afb52ad68","fieldValues":{"created_at_dttm":"2019-07-24T13:08:35.718Z","created_by_user_id": "viadmin","last_updated_at_dttm": "2019-07-24T15:20:39.132Z", "last_updated_by_user_id": "viadmin","nom": "BALISTE","prenom":"Fred","dob":"2019-04-25","pob":"Lechnord","I_validation":"AUTO","test_modification_id": "8ce7a94a-576f-4a93-9332-825afb52ad68","version":4}}'

 

 

but without success. Postman output is that my "update request is no longer valid" and ask me to "get back the current state for the resource". I don't undestand what to do, any idea?

 

Any help would be greatly appreciated!

 

Regards,

1 ACCEPTED SOLUTION

Accepted Solutions
mtlppe
SAS Employee

Hi,

 

The records within VI are versioned to ensure that the concurrent modifications do not overwrite each other. This is enforced by the version and modification timestamp fields, which are set to "version" and "last_updated_at_dttm" fields. 

 

The best approach is to do a GET on the resource first and modify it, ensuring you are starting with the latest resource. The "version" and "last_updated_at_dttm" values from the GET request must match the values in the request body. Keep in mind that the returned resource will have those values updated. 

 

Let me know if you need more assistance. 

 

Cheers,

Paulius. 


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users


View solution in original post

2 REPLIES 2
mtlppe
SAS Employee

Hi,

 

The records within VI are versioned to ensure that the concurrent modifications do not overwrite each other. This is enforced by the version and modification timestamp fields, which are set to "version" and "last_updated_at_dttm" fields. 

 

The best approach is to do a GET on the resource first and modify it, ensuring you are starting with the latest resource. The "version" and "last_updated_at_dttm" values from the GET request must match the values in the request body. Keep in mind that the returned resource will have those values updated. 

 

Let me know if you need more assistance. 

 

Cheers,

Paulius. 


Register today and join us virtually on June 16!
sasglobalforum.com | #SASGF

View now: on-demand content for SAS users


JeanDo
Obsidian | Level 7

Hi Paulius,

Thanks for your response, it's very usefull! In fact I was wrong with these two fields, I was thinking that I had to put the "version" field to the current "version" number plus one, and the "last_updated_at_dttm" to the current datetime.

 

It works fine now!

 

Cheers,

JD