Dears,
I would like to update the validation field of a specific submission of my asset. I tried:
curl -X POST https://kobo.humanitarianresponse.info/api/v2/assets/aSUH9rFcHSpX6kurf5k9Fd/data.json -H "Authorization: Token my-token" -H 'Content-Type: application/json' -d '{ "id": "aSUH9rFcHSpX6kurf5k9Fd","submission": { "meta": { "instanceID": "uuid:0e40f3aa-346f-40a6-ab78-9e2e182bb464", "deprecatedID": "uuid:0e40f3aa-346f-40a6-ab78-9e2e182bb464" } "_validation_status": { "by_whom":"my_user_name","timestamp":1610710761,"uid":"validation_status_on_hold","color":"#0000ff","label":"On Hold"} } }'
But the server response is:
{ "detail":"Method \"POST\" not allowed." }
Any ideas?
ks_1
2
@Josh Can you provide any inputs whether this is possible through API v2?
Josh
3
Hi @timomohr, you can have a look the API docs in your browser for updating validation statuses here:
https://kobo.humanitarianresponse.info/api/v2/assets/{asset_uid}/data/
So in your case, you can visit:
https://kobo.humanitarianresponse.info/api/v2/assets/aSUH9rFcHSpX6kurf5k9Fd/data/
From there you can see that to update the validation status of a submission you need to do the following request:
curl -X PATCH 'https://kobo.humanitarianresponse.info/api/v2/assets/{asset_uid}/data/{submission_id}/validation_status/' \
-H 'Authorization: Token {token}' \
-d 'validation_status.uid={status}'
Where valid statuses include:
validation_status_approved
validation_status_not_approved
validation_status_on_hold
(thanks @ks_1 for the ping)
2 Likes
Josh
4
You can remove the validation status of a submission by making a DELETE
request to the same URL as above
1 Like
Thanks a lot! I’ll check this out in the next days.
1 Like
@Josh @ks_1
I tried to request the validation status like this:
curl -X GET https://kobo.humanitarianresponse.info/api/v2/assets/aSAvYreNzVEkrWg5Gdcvg/data/153648160/validation_status/ -H “Authorization: Token my-token”
The response is:
{“detail”:“Not found.”}
153648160 is the _id of the submission.
Besides, I tried to change the validation status with:
curl -X PATCH https://kobo.humanitarianresponse.info/api/v2/assets/aSUH9rFcHSpX6kurf5k9Fd/data/153648160/validation_status -H “Authorization: Token my-token” -d “validation_status.uid=validation_status_on_hold”
With this request I do not get any response and no change of the validation status.
Josh
7
Hi @timomohr, can you please send me a private message with your username so I can take a look
2 Likes