Groups
Groups
Sign in
Groups
Groups
API Craft
Conversations
About
Send feedback
Help
RESTful nested collections
299 views
Skip to first unread message
Patrick Mulder
unread,
Jan 20, 2013, 5:38:17 AM
1/20/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to api-...@googlegroups.com
Hello,
I am working on an API call that should give information on a collection that belongs to a user. My first idea was
GET
http://example.com/collection.json?username=patrick
response:
{"user": { name: "patrick", ... },
"collection": [
{ "sub-collection": [
{"instance": ..., "url": "..." }
]
}]
}
However, this nested resources does look a bit complicated; any variations to design an API call like this?
(Basically, my use case is very similar to this collection call in flickr, and I would be interested in the photo URLs:
http://www.flickr.com/services/api/flickr.collections.getInfo.html
)
Thanks for sharing thoughts eventually,
Patrick
Mike Kelly
unread,
Jan 20, 2013, 9:09:17 AM
1/20/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to api-...@googlegroups.com
fwiw, if you represent it with hal+json[1] it will look something like this:
{
"_links": {
"self": { "href": "href": "/collection.json?username=patrick" },
"user": { "title": "patrick", "href": "/users/patrick" }
},
"_embedded": {
"items": [
{
"_links": { "self": { "href": "/item/123" },
"instance": ...
},
{
"_links": { "self": { "href": "/item/987" },
"instance": ...
}
]
}
}
[1]
http://tools.ietf.org/html/draft-kelly-json-hal
Cheers,
M
> --
> You received this message because you are subscribed to the Google Groups
> "API Craft" group.
> To unsubscribe from this group, send email to
>
api-craft+...@googlegroups.com
.
> Visit this group at
http://groups.google.com/group/api-craft?hl=en
.
>
>
--
Mike
http://twitter.com/mikekelly85
http://github.com/mikekelly
http://linkedin.com/in/mikekelly123
Patrick Mulder
unread,
Jan 20, 2013, 5:26:07 PM
1/20/13
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to api-...@googlegroups.com, api-...@googlegroups.com
Hi Mike,
thanks for your input. I see some value in the embedded links. About the link type on top level, why not use ID, meta, or root?
It maybe would point potential API consumers into easier semantics, that the payload follows as embedded document, and the rest is just 'meta'
anyway, just exploring right now.
cheers,
patrick
Reply all
Reply to author
Forward
0 new messages