Yes, this is correct. Is this what you are already doing? To give some background: the fileResource functionality is at this point only supported as a backend for File dataValues, and not really as a generic storage mechanism for files. The reason for the two-stage process is that the server needs to perform processing and (potentially) re-uploading of the file (depending on the storage backend used) before it can be stored as a DV.
In the bundled data entry apps (tracker and aggregate) we do this by a three step process: 1) upload the fileResource to api/fileResource and retrieve the returned uid. 2) POST the DV with the value=<fileResource-uid> 3) (optional) Poll the fileResource/<uid> endpoint for the status of the upload to ensure it is properly stored in the backend. Fetching the actual file back can thus only be done on the api/dataValues/files endpoint (with query params just like on any DataValue). On Fri, Jun 3, 2016 at 1:13 PM, Mike Nelushi <mikeevolut...@gmail.com> wrote: > Hi Halvdan, > > We are using version 2.23. The application uses a tracker program and its > suppose to store documents for each user. I can store the file using > fileResources api, and the response storageStatus=PENDING with no errors > thrown. So from the response object I have to create a dataValue(using DE > of type file) then "Store the retrieved id as the value to that data > value". Am I correct? > > Regards, > Mike > > On Fri, Jun 3, 2016 at 11:05 AM, Halvdan Hoem Grelland <halv...@dhis2.org> > wrote: > >> Hi Mike, >> >> In relation to api/fileResources I'm going to need more details: which >> version are you on, exactly what are you trying to do, etc. A full list of >> typically needed details can be found here >> <http://dhis2.github.io/dhis2-docs/master/en/implementer/html/ch09s03.html>, >> but specifically I'll need to know whether there are any thrown errors on >> the server, what HTTP response you are getting and so forth. >> >> Also, have you familiarised yourself with the documentation for the >> fileResource API >> <http://dhis2.github.io/dhis2-docs/master/en/developer/html/ch01s12.html> ? >> In particular make sure to read and understand the constraints (i.e. a FR >> must be referenced by a DataValue). >> >> On Fri, Jun 3, 2016 at 4:58 AM, Morten Olav Hansen <mor...@dhis2.org> >> wrote: >> >>> Hi Mike >>> >>> I'm adding in the dev list, and Halvdan (who knows about file resource >>> API). I will have a look at the start as app functionality. >>> >>> -- >>> Morten >>> >>> On Thu, Jun 2, 2016 at 5:00 PM, Mike Nelushi <mikeevolut...@gmail.com> >>> wrote: >>> >>>> Hi Calle, >>>> >>>> Apologies, forgot to add you on this thread. >>>> >>>> Regards >>>> Mike >>>> On 2 Jun 2016 11:35, "Mike Nelushi" <mikeevolut...@gmail.com> wrote: >>>> >>>>> Hi Morten, >>>>> >>>>> Its Mike here from HISP-SA. >>>>> >>>>> We have been strangling to send email to individual users on our new >>>>> Community Service Application which is going live tomorrow. At the moment >>>>> when I send an email to individuals it sends to everyone who is a DHIS2 >>>>> user. Im user the dhis2.23 messageConversations web-api for this. >>>>> >>>>> A. The following are the two json objects I've used, the first one >>>>> doesn't send messages at all the messages stays on dhis2 mail. >>>>> 1. var json_Data = {"subject": subject, "text": message, "users": >>>>> users}; >>>>> 2.var json_Data = {"subject": subject, "text": message, "users": >>>>> users, "organisationUnits": organisationUnits}; >>>>> >>>>> >>>>> The following is our email settings >>>>> >>>>> [image: Inline image 1] >>>>> >>>>> B. Second Issue is that when we call fileResources webapi to save file >>>>> is does work but when you retrieve the file it says the file was not >>>>> saved. >>>>> The following is the object: >>>>> var file = item[0].files[0]; >>>>> var formData = new FormData(); >>>>> formData.append('file', file); >>>>> >>>>> C. The start page function on Appearance settings is not working if >>>>> you choice your own custom APP, when logging in it does it go to the >>>>> landing page instead it goes to index.action. >>>>> >>>>> Can you please help us with this issues? >>>>> >>>>> Regards, >>>>> Mike >>>>> >>>> >>> >>> _______________________________________________ >>> Mailing list: https://launchpad.net/~dhis2-devs >>> Post to : dhis2-devs@lists.launchpad.net >>> Unsubscribe : https://launchpad.net/~dhis2-devs >>> More help : https://help.launchpad.net/ListHelp >>> >>> >> >> >> -- >> Halvdan Hoem Grelland >> Software developer, DHIS 2 >> University of Oslo >> http://www.dhis2.org <https://www.dhis2.org/> >> >> > -- Halvdan Hoem Grelland Software developer, DHIS 2 University of Oslo http://www.dhis2.org <https://www.dhis2.org/>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp