Examples
Here you can see examples of GET and POST requests, and GET and POST responses used in Mim for all available endpoints. All endpoints are HTTPS only.
- Requests
- GET
- POST
- Responses
- Status
- GET
- POST
- Index
- GET
- POST
- Entity endpoints
- GET
- POST
- Status
Requests
GET
You can issue GET requests by just pointing your browser towards that link. These will give you last day's cache in a paginated format, with a link to be able to jump to the cache of the day before, and so on.
Without filters
https://[ip-address-of-node]:[port]/[protocol-version]/[endpoint]/[page_number]
Endpoints
These are all of the endpoints available in the base protocol. Extensions can extend the protocol in a way that can create new endpoints, new objects and new behaviours.
https://1.2.3.4:34821/v0/status.json
https://1.2.3.4:34821/v0/boards/index.json
https://1.2.3.4:34821/v0/threads/index.json
https://1.2.3.4:34821/v0/posts/index.json
https://1.2.3.4:34821/v0/votes/index.json
https://1.2.3.4:34821/v0/keys/index.json
https://1.2.3.4:34821/v0/addresses/index.json
https://1.2.3.4:34821/v0/truststates/index.json
The [entity]/index endpoints allow you to reach to the index of the existing caches of that endpoint. From this page, you will be given the list of caches you can reach.
Reaching out to actual data
https://localhost:34821/v0/threads/cache_e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/0.json // page 0 of a cache
cache_9843jifnk
is a random name. It can be generated by however the remote wishes. 0
is the first page of that cache. The amount of data are determined by the minimum results policy.
POST
Post requests are usually done to reach non-cached data that is current. (GET requests hit cached data)
General format
Exactly the same endpoints provided above.
The standard POST Request
{
"node_id": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"address": {
"location": "", // Local should infer from connection
"sublocation": "", // Local should infer from connection
"location_type": 0, // Local should infer from connection
"port": 23432,
"type": 2,
"last_online": 0, // Local should infer from connection
"protocol": {
"version_major": 0,
"version_minor": 1,
"subprotocols": [
{
"name":"c0",
"version_major":1,
"version_minor":0,
"supported_entities": ["board", "thread", "post", "vote", "key", "truststate"]
}
]
},
"client": {
"version_major": 2,
"version_minor": 0,
"version_patch": 0,
"name": "Aether"
}
},
"filters": [{"type":"fingerprint", "values":[]}]
}
Filters section should receive the filters you want to have. Check the endpoints documentation for available filters for each endpoint.
This all below, excluding filters section,m will be called [[node info]] in this document after this for the sake of brevity.
Without filters
If the filter array is empty, the remote will assume that means a timestamp filter of a week, which is the longest duration you can ask for. When you do a post, you have to have a request body.
With filters
There are three types of filters that you can provide within the POST request body given above.
- Timestamp
- Fingerprints
- Embeds
Timestamp
{
// [[node info]]
"filters": [
{
"type": "timestamp",
"values": ["1442039887", "1442039891"] <- those are strings, not numbers!
}
],
}
Fingerprints
{
// [[node info]]
"filters": [
{
"type": "fingerprint",
"values": [
"bdb237bf8c5de6b60ba1e2dcfe364fc24f583e568d1682f851a9d0f11a45c78d",
"421c76d77563afa1914846b010bd164f395bd34c2102e5e99e0cb9cf173c1d87",
"e23e44bf8d3adfa1c78d22c13554ffd12002d6ed2a016087d37d3d6f9ab47991",
"0f5c0b2e41c7646b11a0e24080ab59e63fd9d21331c99859d5fad7937c1992c9"
]
}
],
}
Embeds
{
// [[node info]]
"filters": [
{
"type": "embed",
"values": ["threads", "keys"]
}
],
}
Responses
Status
Example GET response
HTTP 200 OK
With no body.
Example POST response
{
"node_id": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"address": {
"location": "", // L should infer from connection
"sublocation": "", // L should infer from connection
"location_type": 0, // L should infer from connection
"port": 23432,
"type": 2,
"last_online": 0, // L should infer from connection
"protocol": {
"version_major": 0,
"version_minor": 1,
"extensions": []
},
"client": {
"version_major": 2,
"version_minor": 0,
"version_patch": 0,
"name": "Aether"
}
},
"entity": "status",
"endpoint": "status",
}
The general format is https://[node ip]:[node port]/[endpoint]/[response_url]/[page_number]
Entity Endpoints
Example GET entity index Response
Example endpoint: https://1.2.3.4:34821/v0/[entity]/index
. Same structure with all [entity]/index endpoints. The items in results
section are caches with their start and ending dates denoted.
{
"node_id": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"address": {
"location": "", // L should infer from connection
"sublocation": "", // L should infer from connection
"location_type": 0, // L should infer from connection
"port": 23432,
"type": 2,
"last_online": 0, // L should infer from connection
"protocol": {
"version_major": 0,
"version_minor": 1,
"extensions": []
},
"client": {
"version_major": 2,
"version_minor": 0,
"version_patch": 0,
"name": "Aether"
}
},
"entity": "boards",
"endpoint": "entity_index",
"timestamp": 1442097755,
"results": [
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
},
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
},
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
},
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
},
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
},
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
},
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
},
{
"response_url": "cache_55a295c39e222e3f94d82d795654a0fea9bc981cd2ae82d7c7b8d4975aa52688",
"starts_from": 1000952512,
"ends_at": 1445197252
}
]
}
Example GET cache index response
Example endpoint: //localhost:8000/posts/cache_0c558847c...7b14/index/0.json
{
"node_id": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"address": {
"location": "",
"sublocation": "",
"location_type": 0,
"port": 0,
"type": 2,
"last_online": 0,
"protocol": {
"version_major": 0,
"version_minor": 1,
"extensions": []
},
"client": {
"version_major": 2,
"version_minor": 0,
"version_patch": 0,
"name": "Aether"
}
},
"entity": "boards",
"endpoint": "cache_index",
"timestamp": 1448163764,
"starts_from": 1447814295,
"ends_at": 1447900695,
"pagination": {
"pages": 0,
"current_page": 0
},
"caching": {
"served_from_cache": true,
"cache_scope": "day",
"prev_cache_url": "cache_664b09483da3a122512200656ba707626a330c441ee6ef02506be57eb4047ffa",
"current_cache_url": "cache_fa798564efd639282d66a5f8ee6c6171d35633b420a7ffaaf0318748a84e62d1"
},
"response": [
{
"fingerprint": "0221c70a30df591e548b2a13674cb85d9e4be3841c6434cdb0ec6e22b8b1bfc3",
"creation": 1439603165,
"last_update": 1447900175
},
{
"fingerprint": "50b12fb93ebde496b74bf0ef2dbe08639f7d04ecd7a92bf053505b0c8d6de699",
"creation": 1439733415,
"last_update": 1447899299
},
{
"fingerprint": "1c28d1b805bd6c4284d6a6344b5c853454ffd4f79f74ae752b1471cb98e75c47",
"creation": 1446817789,
"last_update": 1447899118
}
]
}