-
Notifications
You must be signed in to change notification settings - Fork 0
Writing diories
Jouni Alanen edited this page Jan 6, 2017
·
4 revisions
Create new request - POST /diories
Create new response - POST /diories
Update request - PATCH /diories/1
Update response PATCH /diories/1
Delete request - DELETE /diories/1
Delete response - DELETE /diories/1
curl 'http://localhost:3000/v1//diories' \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: 5e423f7c-8545-4ae9-ad7d-634a7f00e03a' \
--data-binary '{
"data": {
"attributes": {
"name": null,
"diory-type": null,
"date": null,
"address": null,
"background": null,
"created": null,
"modified": null
},
"type": "diories"
}
}'
201 - Created
{
"data" : {
"id" : "1",
"type" : "diories",
"links" : {
"self" : "http://localhost:3000/v1/diories/1"
},
"attributes" : {
"diory-type" : null,
"diory-id" : "565221bd-d574-44b5-9ea4-addac10c620c",
"version" : "0.1.9",
"background" : null,
"created" : "2017-01-06T10:16:15+02:00",
"date" : null,
"name" : null,
"data" : {},
"modified" : "2017-01-06T10:16:15+02:00",
"room-id" : "5e423f7c-8545-4ae9-ad7d-634a7f00e03a",
"address" : null,
"location" : {
"type" : "",
"coordinates" : []
}
},
"relationships" : {
"room" : {
"links" : {
"self" : "http://localhost:3000/v1/diories/1/relationships/room",
"related" : "http://localhost:3000/v1/diories/1/room"
}
},
"connected-diories" : {
"links" : {
"self" : "http://localhost:3000/v1/diories/1/relationships/connected-diories",
"related" : "http://localhost:3000/v1/diories/1/connected-diories"
}
},
"connections" : {
"links" : {
"self" : "http://localhost:3000/v1/diories/1/relationships/connections",
"related" : "http://localhost:3000/v1/diories/1/connections"
}
}
}
}
}
curl 'http://localhost:3000/v1//diories/1' \
-X PATCH \
-H 'Content-Type: application/vnd.api+json' \
-H 'Accept: application/vnd.api+json' \
-H 'Authorization: 5e423f7c-8545-4ae9-ad7d-634a7f00e03a' \
--data-binary '{
"data": {
"id": "1",
"attributes": {
"name": "Diory.me",
"diory-type": "webpage",
"date": null,
"address": "http://diory.me/",
"background": null,
"created": "2017-01-06T10:10:30+02:00",
"modified": "2017-01-06T10:10:30+02:00"
},
"type": "diories"
}
}'
200 - OK
{
"data" : {
"id" : "1",
"type" : "diories"
"links" : {
"self" : "http://localhost:3000/v1/diories/1"
},
"attributes" : {
"name" : "Diory.me",
"address" : "http://diory.me/",
"diory-type" : "webpage",
"diory-id" : "438e408f-0fe2-42d4-a3ee-bf9222876507",
"room-id" : "5e423f7c-8545-4ae9-ad7d-634a7f00e03a",
"background" : null,
"version" : "0.1.9",
"date" : null,
"location" : {
"coordinates" : [],
"type" : ""
},
"modified" : "2017-01-06T10:10:30+02:00",
"created" : "2017-01-06T10:10:30+02:00",
"data" : {},
},
"relationships" : {
"room" : {
"links" : {
"self" : "http://localhost:3000/v1/diories/1/relationships/room",
"related" : "http://localhost:3000/v1/diories/1/room"
}
},
"connections" : {
"links" : {
"self" : "http://localhost:3000/v1/diories/1/relationships/connections",
"related" : "http://localhost:3000/v1/diories/1/connections"
}
},
"connected-diories" : {
"links" : {
"related" : "http://localhost:3000/v1/diories/1/connected-diories",
"self" : "http://localhost:3000/v1/diories/1/relationships/connected-diories"
}
}
},
}
}
204 - No content
[no response]