For every page containing your content you can add /json
to the end of the web address to retrieve the data for that content.
You can retrieve data for each users stream as a h-feed.
This is an example:
https://transmat.io/glennjones/json
The format for an individual feeds is:
https://transmat.io/{username}/json
You can retrieve specific types of content:
https://transmat.io/{username}/notes/json https://transmat.io/{username}/checkins/json https://transmat.io/{username}/photos/json https://transmat.io/{username}/people/json https://transmat.io/{username}/places/json
Note: the peoples feed is return as a collection of h-card's.
Every individual item of content you add to transmat has a web address, again by adding /json to the end of the address you will receive the data for this content item as a h-entry.
This is an example:
https://transmat.io/glennjones/notes/2014-07-31/json
The format for a content types is:
https://transmat.io/{username}/{contenttype}/{itemname}/json
The photo’s section of the site returns images. As images are added to transmat a couple of different sizes are created. These are called, standard and thumbnail you can request these different image sizes using the follow web address formats
These are examples:
https://transmat.io/glennjones/photos/2013-08-28 https://transmat.io/glennjones/photos/2013-08-28?size=thumbnail https://transmat.io/glennjones/photos/2013-08-28?size=standard
The format for image is:
https://transmat.io/{username}/photos/{itemname} https://transmat.io/{username}/photos/{itemname}?size=thumbnail https://transmat.io/{username}/photos/{itemname}?size=standard
Images can be uploaded in different file formats such as JPEG or PNG you can find out the format of an image by viewing the alternates section of the JSON output for a photo. It will provide you with a mime-type.
This is an example:
https://transmat.io/glennjones/photos/2013-08-28/json
The JSON feeds can be paged. Adding a number after the normal web address and before adding the /json
to the end of the address.
This is an example:
https://transmat.io/glennjones/notes/2/json
The default number of items returned is 20, if you would like to change this you can add the querystring pagesize
:
This is an example:
https://transmat.io/glennjones/notes/json?pagesize=30
transmat provides a way to query your data. Queries can be constructed against the properties of any JSON objects.
Tags in transmat are called category
much like in other blogging systems. To build a query to retrieve items filtered by tags, simply create a JSON string with a property called category
and set the value to the tag you wish to filter the content by:
{"category":"indiewebcamp"}
Add this to the end of the streams web address as a querystring named "query".
https://transmat.io/glennjones/json/?query={%22category%22:%22indiewebcamp%22}
If you wish to filter by a query that matches part of a word you can use the contains
operator. The example below queries the syndication property to see if the URL it stores contains the text "twitter.com":
{"syndication":{"contains":"twitter.com"}}
https://transmat.io/glennjones/json/?query={"syndication":{"contains":"twitter.com"}}&pagesize=1
This request also uses the pagesize querystring to limit the results to one item.
You can join property queries together by adding two property/values to the JSON string. This query filters results to return items with the tag indiewebcamp
and has been syndicated to twitter.
{
"category":"indiewebcamp",
"syndication":{"contains":"twitter.com"}
}
https://transmat.io/glennjones/json/?query={"category":"indiewebcamp","syndication":{"contains":"twitter.com"}}
If you wish to filter by a query that excludes a value you can use the not
operator. The example below queries the category property and excludes any item tagged with draft
.
{"category":{"not":"draft"}}
Add this to the end of the streams web address as a querystring named "query".
https://transmat.io/glennjones/json/?query={"category":{"not":"draft"}}
The properties you can query are based on those of h-entry and h-cite
name | the name or title of the content |
content.value | the content formatted as plain text |
content.html | the content formatted as HTML |
url | URLs for this content |
published | the date the content was published in ISO format |
category | tags for the content |
photo | URLs of photos that relate to the content |
longitude | a longitude used to geo tag the content |
latitude | a latitude used to geo tag the content |
syndication | URLs where copies of the content have been syndicated to |
comment | embedded h-entry(s), each of which is a comment on/reply to the parent h-entry |
in-reply-to | embedded h-cite(s), each of which is a considered reply to the parent h-entry |
like-of | embedded h-entry(s), each of which is considered to be a “like” of the parent h-entry |
repost-of | embedded h-cite(s), each of which is a considered reply to the parent h-entry |
Some of the text in the data in transmat can be free text searched. The free text search is case insensitive and can be used for search phrase as well as individual terms. A phase needs to be escaped with double quotes i.e. "\"ssl certificate\""
. The text search uses stemming of words. So if a document field contains the word blueberry, a search on the term blue will not match. However, blueberry or blueberries will match.
Cannot be used with nearby search
A free text search for enties that contain the word/phrase "eagles" in the places collection.
{
"text":{"search":"eagles"}
}
https://transmat.io/glennjones/places/json/?query={"text":{"search":"eagles"}}
Some entries in transmat have geo data such as places. These entries can be sorted into a list of locations near to a set of coordinates you pass as query. The coordinates are passed a a GeoJSON point. The results are not paged like other queries. Each result has an additional property x-distance
which is the distance in meters of an entry from the coordinates you passed.
Cannot be used with free text search
A nearby search for entries close the geo:-0.1411475,50.839651 which have the category pub.
{
"near":{
"geometry":{
"type":"Point",
"coordinates":[-0.1411475,50.839651]
}
},
"category":"pub"
}
https://transmat.io/glennjones/places/json/?query={"near":{"geometry":{"type":"Point","coordinates":[-0.1411475,50.839651]}},%22category%22:%22pub%22}
In transmat all content items are either public or private. If the browser you are using is logged into transmat you can access both public and private items in the JSON. In the future we will provide OAuth connections so external apps and code can access the private data of users who grant access.
You can filter the types of documents in a stream using a querystring.
http://localhost:3010/glennjones/?filterType=[h-as-note,h-as-photo]The types are h-as-post, h-as-note, h-as-photo or h-as-checkin