These are chat archives for collectiveaccess/support

1st
Nov 2018
Ari
@artturimatias
Nov 01 2018 06:44
Hi,
does anyone know if files can be uploaded via REST api? At least documention says nothing about it: https://docs.collectiveaccess.org/wiki/Web_Service_API
TBthegr81
@TBthegr81
Nov 01 2018 11:52

@artturimatias Kinda but not really.
What you can do is reference a media-file in a directory outside of CAs folders when creating a object or entity via the service API, and that media-file will be imported and processed like any other. But ya goto write some code yourself to handle uploading and storage of the files.
I made a seperate site that handles file-uploads to a folder, and then calls the CA service.php API and creates a new object with the uploaded file referenced, it's not pretty but it works.

What you probably would wanna do is make a proper API endpoint in CAs service controllers that handles uploads

Ari
@artturimatias
Nov 01 2018 12:09
Thanks @TBthegr81 , and yes, I would like to add files to existing objects via REST. Pity, the API is quite useful otherwise.
TBthegr81
@TBthegr81
Nov 01 2018 13:25
Hmm, trying to export things via caUtils export-data function.
As a searchterm I use "ca_objects.collection:6" to export all items from a collection.
But I get more items than I expect, items not part of that collection.
Why could that be and is there some more specific search term I could use?
TBthegr81
@TBthegr81
Nov 01 2018 14:20
I tried a search using the service API where I bundled collection_id and then I used the same search-query as in my export.
I still get the same wrong objects returned, and their bundled collection_id is null. Furthering my confusion
Julia
@juliaweist
Nov 01 2018 20:49
@murchmurch we'll look into it. In the meantime is it possible for you to delete the old list items and create new ones in their place as a workaround until we resolve the issue?