0

I have a python script that take image using raspberry pi and update a JSON file with id and image URL, which is consumed by an iOS app.(Read Directly the JSON file)

  • I need a web service that parse the JSON and provide me with only image that is taken recently and return a JSON of new image and id.
  • so far I can put the code for the web service in the python script used for taking the image and access it using the URL : http://0.x.x.x:5000/application/api/v1.0/image
  • The above returns a JSON with old and new images and id's
  • Another problem is, I have to include the port number.

I tried Flask-RESTful for the above.

Is there any ready to use API's that can do this for me, or if I am to write my own web service what is the correct approach.

I have apache server running on the PI, how can I deploy the API and access it using the URL like ://PIAdress/application/Api/image

If there is a better approach please suggest.

moz ado
  • 490
  • 4
  • 17

1 Answers1

0
  • Deploy Api to apache2 : example

  • have two app route : one to get full JSON - application/api/v1.0/image , second to get updated JSON - application/api/v1.0/image/'<'date'>'

  • get date from JSON and compare with the date from the app - (minus) 10 mins : add to a list with JSON date that are greater than the compareDate

  • return jsonify(list) - for json of new image

moz ado
  • 490
  • 4
  • 17