This standalone software is meant to provide a global public directory of Friendica profiles across nodes.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
friendica-directory/docs/Protocol.md

135 lines
3.7 KiB

4 years ago
# Friendica Directory Protocol
## Surprise
```
GET /servers/surprise
```
Redirects to the base URL of a random server with open registration policy and above 75 health.
4 years ago
## Search
```
GET /search[/account_type]?q=...[&page=...][&limit=...]
4 years ago
Accept: application/json
```
URI Parameter:
- `account_type` (optional): An arbitrary account type string. Expected values are `all`, `people`, `news`, `organization` and `forum`. Default is `all`.
Query parameters:
4 years ago
- `q`: The search query.
- `page` (optional): The page number, default is 1.
- `limit` (optional): The page size, default is 20, max is 100.
4 years ago
Returns a JSON structure containing a paginated list profiles matching the search query and the optional account type.
Example:
```json
{
"query": "philosophy",
"page": 1,
"itemsperpage": 20,
"count": "13",
"profiles": [
{
"id": "2259",
"name": "Hyp🌧lite Pe☂ov🍃n (he/him)",
"username": "hypolite",
"addr": "hypolite@friendica.mrpetovan.com",
"account_type": "People",
"pdesc": "Subpar geek, french/english, science, games, feminism, jokes and anything in between. Avatar by @DearMsDear@mastodon.art",
"locality": "Brooklyn",
"region": "New York",
"country": "USA",
"profile_url": "https://friendica.mrpetovan.com/profile/hypolite",
"photo": "https://friendica.mrpetovan.com/photo/27330388315ae4ed2b03e3c116980490-4.jpg?ts=1541567135",
"tags": "videogame gaming boardgame politics philosophy development programming php",
"last_activity": "2018-45",
"remote_follow": "https://friendica.mrpetovan.com/remote_follow/hypolite",
"subscribe": null
},
...
]
}
```
### Legacy interest match search
```
POST /msearch
Content-Type: application/x-www-form-urlencoded
Accept: application/json
```
Parameters:
- `s`: The search query, a list of tags separated by spaces or commas is expected.
- `p` (optional): The page number, default is 1.
- `n` (optional): The number of items per page, default is 80.
Returns a JSON structure containing a paginated list profiles matching the search query and the optional account type.
Example:
```json
{
"query": "videogame gaming boardgame politics philosophy development programming php",
"page": 1,
"items_page": 100,
"total": 32,
"results": [
4 years ago
{
"name": "Hyp🌧lite Pe☂ov🍃n (he/him)",
"url": "https://friendica.mrpetovan.com/profile/hypolite",
"photo": "https://friendica.mrpetovan.com/photo/27330388315ae4ed2b03e3c116980490-4.jpg?ts=1545521478",
"tags": "videogame gaming boardgame politics philosophy development programming php"
4 years ago
},
...
]
}
```
## Profile submission
`GET /submit?url=...`
Parameters:
- `url`: a hexadecimal-encoded profile URL to be added to the directory.
The success of the operation is indicated by the HTTP response code.
## Synchronization
`GET /sync/pull/all`
Returns a JSON structure containing all the profiles displayed by the directory.
Example:
```json
{
now: 1541942034,
count: 7435,
results: [
"http://example.com/profile/test",
...
]
}
```
`GET /sync/pull/since/1541942034`
Returns a JSON structure containing profiles displayed by the directory that have been updated since the provided UNIX timestamp.
Example:
```json
{
now: 1541942160,
count: 2766,
results: [
"http://example.com/profile/test",
...
]
}
```