Browse Source

Merge pull request #8 from snarfed/target_domain_docs

add new target_domain param to /webmention API docs. for #2
pull/9/head
Aaron Parecki 8 years ago
parent
commit
83625ba17c
1 changed files with 18 additions and 1 deletions
  1. +18
    -1
      views/api.php

+ 18
- 1
views/api.php View File

@ -13,13 +13,15 @@ Post to `https://telegraph.p3k.io/webmention`
* `token` - your API key obtained after signing up
* `source` - the URL of your post
* `target` - the URL you linked to
* `target` OR `target_domain` - the URL or domain you linked to, respectively
* `callback` - (optional) - a URL that will receive a web hook when new information about this webmention is available
The Telegraph API will validate the parameters and then queue the webmention for sending. If there was a problem with the request, you will get an error response immediately.
The API will first make an HTTP request to the source URL, and look for a link to the target on the page. This happens synchronously so you will get this error reply immediately.
If you pass `target_domain` instead of `target`, Telegraph will find and enqueue webmentions for all links to that domain.
#### Errors
* `authentication_required` - the token parameter was missing
* `invalid_token` - the token was invalid or expired
@ -55,6 +57,21 @@ Location: https://telegraph.p3k.io/webmention/xxxxxxxx
}
```
If you use `target_domain` instead of `target`, the `location` field will be a list containing the status URLs for each webmention that was queued. The `Location` header will be omitted.
```
HTTP/1.1 201 Created
Content-type: application/json
{
"status": "queued",
"location": [
"https://telegraph.p3k.io/webmention/xxxxxxxx",
"https://telegraph.p3k.io/webmention/yyyyyyyy"
]
}
```
<h2 class="ui dividing header">Status API</h2>
You can poll the status URL returned after queuing a webmention for more information on the progress of sending the webmention. The response will look like the following:

Loading…
Cancel
Save