Marc F
Marc F

Reputation: 13

How do I change a Podio Category Field using PUT and JSON?

I am attempting to update a Podio field (category field) value using a PUT call. I have tried dozens of variations on the below, but using what I found on the Podio developer site, I'm placing a PUT call using the following info:

PUT http://api.podio.com/item/{item_id}/value/{field_id} (These are correct)
Content-Type: application/json; charset=utf-8
Authorization: OAuth2 {access_token} (Again, this is correct)

"prequal-sent": 1

I have tried many different variations on the JSON itself, but the above is what the App Developer section says should would.

My issue is that no matter what I do, Podio just removes all of the data in that field and responds with a "success" response. So I know I'm authorized, and accessing the correct field, I just can't figure out the JSON to actually make it work. Any help would be greatly appreciated.

Upvotes: 1

Views: 225

Answers (1)

Pavlo - Podio
Pavlo - Podio

Reputation: 2013

There are, probably, 2 changes needed to make it working:
1. Body of your request need to be in json format
2. Value should be an array but not single index

PUT https://api.podio.com/item/{item_id}/value/ 
Content-Type: application/json; charset=utf-8
Authorization: OAuth2 {access_token}

{"prequal-sent": [2]}

I've tried it on app which has single category field which is called 'Category' with external-id as 'category', which allows multiple options selected, and this command works great for me:

curl 
    -H "Content-Type: application/json" 
    -H "Authorization: OAuth2 <myauth>" 
    -X PUT 
    -d '{"category":[1,3]}' 
    "https://api.podio.com/item/<item-id>/value/"

Upvotes: 2

Related Questions