Skip to content

Instantly share code, notes, and snippets.

@mamund
Last active January 3, 2016 02:09
Show Gist options
  • Save mamund/8393439 to your computer and use it in GitHub Desktop.
Save mamund/8393439 to your computer and use it in GitHub Desktop.
Representing unique (non-item) POST templates in compliant Collection+JSON. 1) list.js shows a list of sheduled meetings 2) each item has a "patch" link that points to another representation 3) patch.js shows a response from the "patch" link showing only a template to fill out. client apps SHOULD use POST to send this payload.
{
"collection" : {
"version" : "1.0",
"href" : "http://example.org/schedules",
"links" : [
{"link" : {"rel" : "profile", "href" : "http://example.org/profiles/schedules"},
{"link" : {"rel" : "http://example.org/rels/rssfeed", "href" : "http://example.org/schedules/index.rss"}
],
"items" : [
{ "href" : "http://example.org/schedules/1",
"data" : [
{"name" : "title", "value" : "Planning Meeting", "prompt" : "Title"},
{"name" : "startDateTime", "value" : "2014-02-01 13:00:00", "prompt" : "Starts"},
{"name" : "endDateTime", "value" : "2014-02-01 14:00:00", "prompt" : "Ends"},
{"name" : "location", "value" : "Badger Room", "prompt" : "Location"}
],
"links" : [
{"link" : {"rel" : "http://example.org/rels/attendees", "href": "http://example.org/schedules/attendees/s=1"},
{"link" : {"rel" : "http://example.org/rels/mod", "href" : "http://example.org/mod?s=1"}
]
},
{ "href" : "http://example.org/schedules/2",
"data" : [
{"name" : "title", "value" : "Billy's Lunch", "prompt" : "Title"},
{"name" : "startDateTime", "value" : "2014-01-31 11:00:00", "prompt" : "Starts"},
{"name" : "endDateTime", "value" : "2014-01-31 13:00:00", "prompt" : "Ends"},
{"name" : "location", "value" : "Honey Room", "prompt" : "Location"}
],
"links" : [
{"link" : {"rel" : "http://example.org/rels/attendees", "href": "http://example.org/schedules/attendees?s=2"},
{"link" : {"rel" : "http://example.org/rels/mod", "href" : "http://example.org/mod?s=2"}
]
}
],
"template" : {
"data" : [
{"name" : "title", "value" : "", "prompt" : "Title"},
{"name" : "startDateTime", "value" : "", "prompt" : "Starts"},
{"name" : "endDateTime", "value" : "", "prompt" : "Ends"},
{"name" : "location", "value" : "", "prompt" : "Location"}
]
}
}
}
{
"collection" : {
"version" : "1.0",
"href" : "http://example.org/mod?s=2",
"links" : [
{"link" : {"rel" : "profile", "href" : "http://example.org/profiles/schedules"}
],
"template" : {
"data" : [
{"name" : "startDateTime", "value" : "", "prompt" : "Starts"},
{"name" : "endDateTime", "value" : "", "prompt" : "Ends"}
]
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment