favorites resource endpoint
URL: /users/<id>/favorites.<format>
Supported Methods
POST | Create a new favorite in the selected user's list of favorites. |
GET | Get a list of favorites that were listed by the selected user. |
Query String Arguments
- start-index
- Index of the first item to return. The first item in the list has index 1.
- max-results
- Maximum number of items to return in the list response.
Resource Type
This endpoint returns an object of type List<Favorite>.
- entries (array<Favorite>)
- The items within the selected range.
- totalResults (integer)
- The total number of items in the whole list of which this object is a chunk.
POST Request Object Type
This endpoint expects POST requests to contain objects of type Favorite.
- author (User)
- The user who saved this favorite. That is, this property is the user who saved the target asset as a favorite, not the creator of that asset.
- id (string)
- A URI that serves as a globally unique identifier for the favorite.
- inReplyTo (AssetRef)
- A reference to the target asset that has been marked as a favorite.
- published (datetime)
- The time that the favorite was created, as a W3CDTF timestamp.
- urlId (string)
- A string containing the canonical identifier that can be used to identify this favorite in URLs. This can be used to recognise where the same favorite is returned in response to different requests, and as a mapping key for an application's local data store.
Client Library Methods for PHP
- Get a list of favorites that were listed by the selected user.
$tp->users->getFavorites(array( # Required Parameters "id" => $id, # Optional Parameters "limit" => $limit, "offset" => $offset, ))
- Create a new favorite in the selected user's list of favorites.
$tp->users->postToFavorites(array( # Required Parameters "id" => $id, "payload" => $payload, ))
Example Request
GET /users/6p012877b13de7970c/favorites.json?max-results=4 HTTP/1.1
Host: api.typepad.com
HTTP/1.0 200 OK
Content-type: application/json
Content-length: 2500
{
"entries": [
{
"published": "2010-02-18T00:31:02Z",
"urlId": "6a012877b13de7970c012877b143d0970c:6p012877b13de7970c",
"inReplyTo": {
"urlId": "6a012877b13de7970c012877b143d0970c",
"excerpt": "I've started this blog to share interesting law facts and information about cases I find interesting. Information in this blog is not legal advice.",
"objectTypes": [
"tag:api.typepad.com,2009:Post"
],
"author": {
"urlId": "6p012877b13de7970c",
"location": null,
"interests": [],
"objectTypes": [
"tag:api.typepad.com,2009:User"
],
"profilePageUrl": "http://profile.typepad.com/loblawatlaw",
"aboutMe": null,
"objectType": "User",
"preferredUsername": "loblawatlaw",
"id": "tag:api.typepad.com,2009:6p012877b13de7970c",
"avatarLink": {
"width": 250,
"url": "https://static.typepad.com/.shared/default-userpics/11-250si.gif",
"height": 250
},
"displayName": "Bob Loblaw"
},
"permalinkUrl": "https://bobloblaw.typepad.com/blog/2010/02/welcome-t.html",
"href": "assets/6a012877b13de7970c012877b143d0970c.json",
"objectType": "Post",
"type": "application/json",
"id": "tag:api.typepad.com,2009:6a012877b13de7970c012877b143d0970c",
"title": "Welcome to my Blog"
},
"id": "tag:typepad,2009:6a012877b13de7970c012877b143d0970c:6p012877b13de7970c",
"author": {
"urlId": "6p012877b13de7970c",
"location": null,
"interests": [],
"objectTypes": [
"tag:api.typepad.com,2009:User"
],
"profilePageUrl": "http://profile.typepad.com/loblawatlaw",
"aboutMe": null,
"objectType": "User",
"preferredUsername": "loblawatlaw",
"id": "tag:api.typepad.com,2009:6p012877b13de7970c",
"avatarLink": {
"width": 250,
"url": "https://static.typepad.com/.shared/default-userpics/11-250si.gif",
"height": 250
},
"displayName": "Bob Loblaw"
}
}
],
"totalResults": 1
}