-
Notifications
You must be signed in to change notification settings - Fork 4
Following Process
(From https://tent.io/docs/server-protocol)
The process to start following another entity is to use HTTP POST to your own /followers
URL with the information needed to start following that entity.
Assuming I am the entity alex
on my own server pytent.alexanderdbrown.com
and want to follow james
on his server tent.example.com
POST https://pytent.example.com/alex/followers HTTP/1.1
Content-Type: application/vnd.tent.v0+json
Accept: application/vnd.tent.v0+json
...
The accompanying json files would be:
{
"entity": "https://tent.example.org/james",
"types": [
"all"
],
"notification_path": "notifications/followers",
"licenses": [
"http://creativecommons.org/licenses/by/3.0/"
]
}
This will start off by performing a HEAD request on james
.
HEAD https://tent.example.org/james HTTP/1.1
...
Returning the link header with james
's profile.
HTTP/1.1 200 OK
Link: <https://tent.example.org/james/profile>; rel="https://tent.io/rels/profile"
...
My server now has a link to his profile. As part of server discovery, this needs to have a GET performed on it to make sure the canonical entity is correct.
GET https://tent.example.org/james/profile HTTP/1.1
Accept: application/vnd.tent.v0+json
...
Which will return:
HTTP/1.1 200 OK
Link: <https://tent.example.org/james/profile>; rel="https://tent.io/rels/profile"
Content-Type: application/vnd.tent.v0+json
...
With the data along the lines of:
{
"https://tent.io/types/info/core/v0.1.0": {
"licences": [
"http://creativecommons.org/licenses/by/3.0/"
],
"servers": [
"https://tent.example.com/james"
],
"tent_version": "0.2",
"entity": "https://tent.example.com/james"
}
}
From here we would make sure the entities are matching. If they are we then issue a POST to our own notification path to make sure that works.
POST https://pytentd.alexanderdbrown.com/alex/notification/followers HTTP/1.1
Content-Type: application/vnd.tent.v0+json
Accept: application/vnd.tent.v0+json
...
Which will return some form the json. I'm not quite sure what yet ;-)
Finally the follower relationship is saved into the database and finally the following data will be returned to the client:
HTTP/1.1 200 OK
Content-Type: application/vnd.tent.v0+json
...
{
"entity": "https://tent.example.org/james",
"created_at": 1355181298,
"permissions": {
"public": true
},
"id": ...,
"mac_key_id": ...,
"mac_key": ...,
"mac_algorithm": ...,
"licenses": [
"http://creativecommons.org/licenses/by/3.0/"
],
"types": [
"all"
],
"notification_path": "notifications/followers"
}
(As a side note, I'm not exactly sure the point of the id
field in that returned json. I suspect it's just an identifier for the database. But the tent specification isn't forthcoming).
Parts of the information in the above page was taken from: https://tent.io/docs/server-protocol, therefore the following statement has to be included:
Copyright © 2012 by Apollic Software, LLC. All rights reserved
This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Apollic Software, LLC.
This website and all and the documents and information contained herein is provided on an "AS IS" basis and Apollic Software, LLC DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.