mysociety / fixmystreet-mobile

Cordova application for making reports to FixMyStreet
Other
49 stars 48 forks source link

how Photo is added to the database ? #214

Closed loran750 closed 8 years ago

loran750 commented 8 years ago

Hello

As I am creating an app from scratch, I don't understand the data model for the photo. here is the workflow I've understood :

  1. upload the picture
  2. send the report

but I don't know how to link the picture and the report.

regards

dracos commented 8 years ago

If you're posting a new report, you can include the photo as part of that in the POST along with the rest of the report data, as one form submission. The photo is automatically associated with the report in that case.

If you wish to upload the photo separately, then you can do so using the /photo/upload endpoint which accepts a photo and returns the ID it has given that photo. You then include that ID (or multiple IDs, up to three, separated by commas) in the upload_fileid field of your report POST and the photo will be associated with that report.

loran750 commented 8 years ago

thank you very much Dracos.