Modes (p:modes)¶
http://profiles.goabout.com/modes
The Modes (p:modes) profile represents a collection of Mode (p:mode) resources.
Example¶
{
"_embedded" : {
"item" : [ {
"type" : "bicycle",
"label" : "Jouw fiets",
"logoHref" : "https://goabout.com/pages/generic/home-bike.png",
"href" : "https://goabout.com/pages/generic/home-bike",
"description" : "De fiets die bij jouw voor de deur staat.",
"_links" : {
"self" : {
"href" : "https://api.goabout.com/mode/102"
},
"http://rels.goabout.com/owner" : {
"href" : "https://api.goabout.com/user/42"
}
}
}, {
"type" : "bicycle",
"label" : "Stations-fiets",
"standHref" : "https://api.goabout.com/location/stop/4b95d4b4",
"logoHref" : "https://goabout.com/pages/generic/trainstation-bike.png",
"href" : "https://goabout.com/pages/generic/trainstation-bike",
"description" : "De fiets die bij op jouw voorkeursstation staat.",
"_links" : {
"self" : {
"href" : "https://api.goabout.com/mode/103"
},
"http://rels.goabout.com/owner" : {
"href" : "https://api.goabout.com/user/42"
}
}
} ]
},
"_links": {
"self": {
"href": "https://api.goabout.com/user/42/modes"
}
}
}
Reference¶
GET¶
Embedded¶
item: | A list of Mode (p:mode). |
---|
POST¶
When posting to this resource, a new Mode (p:mode) will be created with the posted User (p:user) as its owner. Users can create a mode only for themselves and themselves only.
The profile of resource returned is Mode (p:mode).
Properties¶
type: | ModeType The type for the mode to be created. This can only be one of the user-ownable mode-types. |
---|---|
standHref: | URI The train-station this mode is located by default. Setting a location is only possible for bikes and will result in getting trip-advices using your bike if you travel via the trainstation this bike is located at. |
Example¶
$ curl -v -d'{"type":"bicycle"}' -H'Authorization: Bearer UArtDY9Bpo9Whga2mfd7nIK6vENxp2twtnH7RvPC6xj0jy6' -H'Content-Type: application/json' 'https://api.goabout.com/user/42/modes'
[ SSL HANDSHAKE CUT OUT ]
> POST /user/42/modes HTTP/1.1
> Host: api.goabout.com
> User-Agent: curl/7.32.0
> Accept: */*
> Authorization: Bearer UArtDY9Bpo9Whga2mfd7nIK6vENxp2twtnH7RvPC6xj0jy6
>
< HTTP/1.1 201 CREATED
< Server: nginx/1.4.4
< Location: /mode/103
< Date: Fri, 20 Dec 2013 11:06:33 GMT
< Content-Type: application/hal+json
< Content-Length: 476
< Connection: keep-alive
< Cache-Control: private, no-cache, no-storage
{
"type" : "bicycle",
"label" : "Jouw fiets",
"logoHref" : "https://goabout.com/pages/generic/home-bike.png",
"href" : "https://goabout.com/pages/generic/home-bike",
"description" : "De fiets die bij jouw voor de deur staat.",
"_links" : {
"self" : {
"href" : "https://api.goabout.com/mode/103"
},
"http://rels.goabout.com/owner" : {
"href" : "https://api.goabout.com/user/42"
}
}
}
$ curl -v -d'{"type":"bicycle","standHref":"https://api.goabout.com/location/stop/4b95d4b4"}' -H'Authorization: Bearer UArtDY9Bpo9Whga2mfd7nIK6vENxp2twtnH7RvPC6xj0jy6' -H'Content-Type: application/json' 'https://api.goabout.com/user/42/modes'
[ SSL HANDSHAKE CUT OUT ]
> POST /user/42/modes HTTP/1.1
> Host: api.goabout.com
> User-Agent: curl/7.32.0
> Accept: */*
> Authorization: Bearer UArtDY9Bpo9Whga2mfd7nIK6vENxp2twtnH7RvPC6xj0jy6
>
< HTTP/1.1 201 CREATED
< Server: nginx/1.4.4
< Location: /mode/103
< Date: Fri, 20 Dec 2013 11:06:33 GMT
< Content-Type: application/hal+json
< Content-Length: 476
< Connection: keep-alive
< Cache-Control: private, no-cache, no-storage
{
"type" : "bicycle",
"label" : "Jouw fiets",
"standHref" : "https://api.goabout.com/location/stop/4b95d4b4",
"logoHref" : "https://goabout.com/pages/generic/home-bike.png",
"href" : "https://goabout.com/pages/generic/home-bike",
"description" : "De fiets die bij jouw voor de deur staat.",
"_links" : {
"self" : {
"href" : "https://api.goabout.com/mode/103"
},
"http://rels.goabout.com/owner" : {
"href" : "https://api.goabout.com/user/42"
}
}
}