[seagrant-dev] API endpoint output samples

Freeman, Michael Michael.Freeman at oregonstate.edu
Thu Aug 14 23:44:18 UTC 2014


So I looked into importing the json data Evan sent me and I have a small blocker. The data is structured in such a way that each vendor or product is a root. This makes it hard to populate the Sencha store that I am looking at in order to send data to the views. If the items were not specific roots I could easily populate my store.

This is how the Data is sent now:
Note: 24 and 25 are separate objects or “roots” as sencha calls them.
Looking at a specific root this gives me one of the two vendors.
{
                “24”:{
                                “name”: “Joe’s Crab Shack”,
                                “city”: “Newport”,
                                “updated”: “Wednesday”,
                                “zip”: “97333”
                },
“25”:{
                “name”: “Cody’s Clam Shop”,
                                “city”: “Gold Beach”,
                                “updated”: “Wednesday”,
                                “zip”: “97333”
                }
}

If the Data was like this:
Note: One Array or “root” looks at all of the different vendors.
Looking at this root I get both of the vendors.
{
                “vendors”: [
{
                                “name”: “Joe’s Crab Shack”,
                                “city”: “Newport”,
                                “updated”: “Wednesday”,
                                “zip”: “97333”
                },
{
                “name”: “Cody’s Clam Shop”,
                                “city”: “Gold Beach”,
                                “updated”: “Wednesday”,
                                “zip”: “97333”
                }
]
}

I’m just curious as to why each vendor is a specific object, instead of an object inside of an array of related objects. Is that an industry standard? Just not sure of how to use the data as it is output at the moment. I can get the data to load if I change it into the array format above. If anyone can explain it to me a little better that would be nice.

Thanks,
Michael




From: seagrant-dev-bounces at osuosl.org [mailto:seagrant-dev-bounces at osuosl.org] On Behalf Of Evan Tschuy
Sent: Wednesday, August 13, 2014 2:19 PM
To: seagrant-dev at osuosl.org
Subject: [seagrant-dev] API endpoint output samples

I imported some random data and saved the API output with wget so the app devs would have something to play with. If you want something with data that's a little easier to tell apart, I can send you the sample data that I've written but currently there's only two entries for each item.
Evan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osuosl.org/pipermail/seagrant-dev/attachments/20140814/895116c9/attachment-0001.html>


More information about the seagrant-dev mailing list