Subscriptions (p:subscriptions)¶
http://profiles.goabout.com/subscriptions
The Subscriptions (p:subscriptions) profile represents a collection of Subscription (p:subscription) resources.
Example¶
{
"_embedded" : {
"item" : [ {
"productHref" : "https://api.goabout.com/product/23",
"userHref" : "https://api.goabout.com/user/42",
"_links" : {
"self" : {
"href" : "https://api.goabout.com/subscription/2023"
}
}
}, {
"productHref" : "https://api.goabout.com/product/55",
"userHref" : "https://api.goabout.com/user/42",
"_links" : {
"self" : {
"href" : "https://api.goabout.com/subscription/2024"
}
}
} ]
},
"_links": {
"self": {
"href": "https://api.goabout.com/user/42/subscriptions"
}
}
}
Reference¶
GET¶
Embedded¶
item: | A list of Subscription (p:subscription). |
---|
POST¶
When posting to this resource, a new Subscription (p:subscription) will be created with the posted User (p:user) and Product (p:product).
The profile of resource returned is Subscription (p:subscription).
Properties¶
productHref: | URI the href of the product the new subscription should be created for. |
---|---|
properties: | JSON A json object containing the properties as denoted by the json-schema provided by the Product (p:product). |
Example¶
$ curl -v -d'{"productHref":"https://api.goabout.com/product/55"}' -H'Authorization: Bearer UArtDY9Bpo9Whga2mfd7nIK6vENxp2twtnH7RvPC6xj0jy6' -H'Content-Type: application/json' 'https://api.goabout.com/user/42/subscriptions'
[ SSL HANDSHAKE CUT OUT ]
> POST /user/42/subscriptions 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: /subscription/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
{
"productHref" : "https://api.goabout.com/product/55",
"properties" : {
"cardnumber" : "1234-abcd-5678"
}
"_links" : {
"self" : {
"href" : "https://api.goabout.com/subscription/103"
}
}
}