Get all related item ids of an item
Hi ,
I'm creating a script to merge duplicate items in an app. But when I merge 2 items and create a new combined item, the item id changes , and all other workspaces relating to that item loose their connection.
So my question: Is there a way I can get all the related item ids from an item? I'm authorising server side , and I have admin rights on all the workspaces connecting to this item.
-
Hi Rudolph,
You can use the endpoint Get references to item by field to get references to the item.
The request will be something like
GET https://api.podio.com/item/150622336/reference/field/43738642
for item id150622336
and field id43738642
. The response will look like this:[ { "app_item_id": 1640, "item_id": 187458953, "title": "Some title", "link": "https:\/\/podio.com\/myorg\/myspace\/apps\/myapp\/items\/1640", "revision": 8 }, { "app_item_id": 1550, "item_id": 182785131, "title": "Another title", "link": "https:\/\/podio.com\/myorg\/myspace\/apps\/myapp\/items\/1550", "revision": 1 } ]
Hope it helps!
Best,
Andreas -
Thx I think this is exactly what i'm looking for , I've been using the PHP PODIO API Library. Just to check if I'm on the right track I should send a normal get request to the URL and it will return a json string that I will have to decode? This request doesn't exist inside the Library, right?
-
If you're using the PHP client it might be even easier to do this:
$references = PodioItem::get_references(123);
It will call a slight different endpoint, Get item references, and return the result in the following format:
[ { "field": { "field_id": 43738642, "type": "app", JSON REMOVED FOR BREVITY }, "app": { "app_id": 5618736, JSON REMOVED FOR BREVITY }, "items": [ { "app_item_id": 1640, "item_id": 187458953, "title": "Some title", "link": "https:\/\/podio.com\/myorg\/myspace\/apps\/myapp\/items\/1640", "revision": 8 }, { "app_item_id": 1550, "item_id": 182785131, "title": "Another title", "link": "https:\/\/podio.com\/myorg\/myspace\/apps\/myapp\/items\/1550", "revision": 1 } ] } ]
Please sign in to leave a comment.
Comments
5 comments