Page 1 of 1

How do I fetch data from a JSON link?

Posted: Tue Feb 11, 2014 11:11 pm
by Harsha Kuchampudi

Here is the API Access Endpoint: http://data.cityofgainesville.org/res...

I want to create a database that contains this information and updates whenever new data is added.


How do I fetch data from a JSON link?

Posted: Wed Feb 12, 2014 12:03 am
by Alena Prykhodko

Hello Harsha,

This can be done with update service http://docs.appery.io/documentation/b...


How do I fetch data from a JSON link?

Posted: Wed Feb 12, 2014 6:13 am
by Harsha Kuchampudi

Thank you for your help. I am still having some trouble however. Could you please show me what I am supposed to have in the Update Service URL field so that I can fetch data directly from the aforementioned link? I don't understand
"{database_url}/collections/Active_Businesses/{object_id}"


How do I fetch data from a JSON link?

Posted: Wed Feb 12, 2014 9:30 am
by Bad Addy

object_id would be the _id within the collections table Active_Businesses.

As you have within your JSON, a unique number, being ' "number" : "CE-13-01587" ' you would need to put a where clause.

Rather than search each object (the one in your database, and the one in JSON link) it would be faster to just update all fields with new data, even if the data has not changed.

I do all my calls old school, but here is the AJAX version:

code
url: 'https://api.appery.io/rest/1/db/collections/Active_Businesses/',
dataType: 'json',
data: {
where: '{"number" : response.number}'
},
/code

This would give you the _id (or Object_id), which you can then use to update the new data.

I am not expert and still learning Appery myself. But though i could help, as I had a problem like yours.


How do I fetch data from a JSON link?

Posted: Wed Feb 12, 2014 12:11 pm
by Maryna Brodina

Thank you @Bad Addy!
@Harsha Kuchampudi please let us know if you have any questions.


How do I fetch data from a JSON link?

Posted: Wed Feb 12, 2014 2:47 pm
by Harsha Kuchampudi

@Bad Addy @Alena Prykhodko @Maryna Brodina

Thanks for your suggestions and help! I look into your suggestions and see what happens!