Copying item to another space with image

77 views
Skip to first unread message

Matthijn

unread,
Jul 1, 2012, 7:05:50 AM7/1/12
to podi...@googlegroups.com
Good day,

Currently I am working on a system where items from one application in an space can be copied to another application (a clone) in another space based on filters. E.g. when there is a certain value entered for a question it copies the item and else it does not copy the item.

This works as long as the item has no files, videos or images attached to it. When I want to copy an item which for example has an image attached I get an error saying that the file is not available. 

[PODIO] 400 PUT /item/10157852[PODIO] Request body: {"fields":{"title":["testjess"],"image":[17681097]},"tags":[]}[PODIO] Reponse: {"error_propagate":false,"error_parameters":{},"error_detail":null,"error_description":"The file is not available, status is active","error":"The file is not available, status is active"}PUT /item/10157852 HTTP/1.1

Is access to a file / image / video limited to the space it was created in? Or is it possible to reference to files created in another space. 

Thanks.

Christian Holm

unread,
Jul 1, 2012, 7:20:05 AM7/1/12
to podi...@googlegroups.com
Hi

Once a file has been used (or "attached" as we call it) for something in Podio, it cannot simply be reused for other things. So if an image is attached to a certain item, it cannot be reused directly on another item.

Instead you can use the copy operation on the file api, https://developers.podio.com/doc/files/copy-file-89977. This creates a logical copy of the file, so it can be reattached to something else.

However if you want to continually update the item in the other space, please don't keep creating copies of the files. This will cause the files on the target item to continuously be updated with new files, as the just copied file will always be different from the existing files on the target item.

There are no perfect ways to do this currently, but you could use the item revision difference to figure out which values changed, and only update the files when they actually changed. See https://developers.podio.com/doc/items/get-item-revision-difference-22374 for details.

Christian

Matthijn

unread,
Jul 1, 2012, 5:24:24 PM7/1/12
to podi...@googlegroups.com
Thanks,

This makes some things clear. Now I am wondering. When a file is no longer referenced by any item (after it has been attached) is it cleared from the Podio servers? Or do I have to keep track of all the files and delete the item when needed. If the first thing is the case that would sure make live easier.

Kind regards.

Christian Holm

unread,
Jul 2, 2012, 8:46:48 AM7/2/12
to podi...@googlegroups.com
The files are automatically deleted if they are moved from the item values.
Reply all
Reply to author
Forward
0 new messages