Documentation.
This commit is contained in:
52
README.md
52
README.md
@ -83,20 +83,23 @@ Tunnel on port `80` to send traffic. Consume HTTP endpoints:
|
||||
|
||||
### `POST /send`
|
||||
|
||||
Sends message and returns it's ID. Minimal message body where `user2` sends a text message to `user1`, and since `user2` can only message to `user1` and nobody else, they don't even have to specify recipient, the system infers it automatically:
|
||||
Sends message and returns it's ID. Minimal message body where `user2` sends a text message to `user1`, and since `user2` can only message to `user1` and nobody else, they don't even have to specify recipient, the system infers it automatically.
|
||||
|
||||
Request:
|
||||
|
||||
http /send (post) header: Authorization: Bearer f480568f-8884-47e5-a6d7-82480f1ffb3b
|
||||
{
|
||||
"payload": "This is a message."
|
||||
}
|
||||
|
||||
Response
|
||||
Response:
|
||||
|
||||
http (json):
|
||||
"5f33b4bd-dc2a-4ace-947a-1aadc6045995"
|
||||
|
||||
Optionally, messages can be complex. Here is a message from `user1` to `user3`, both `payload` and `payloadType` are `nvarchar` fields and their content can be whatever:
|
||||
Optionally, messages can be complex. Here is a message from `user1` to `user3`, both `payload` and `payloadType` are `nvarchar` fields and their content can be whatever.
|
||||
|
||||
Request:
|
||||
http /send (post) header: Authorization: Bearer 81ccf737-d424-4f83-929c-92d20491abfa
|
||||
{
|
||||
"payloadType": "STATUS",
|
||||
@ -105,13 +108,21 @@ Optionally, messages can be complex. Here is a message from `user1` to `user3`,
|
||||
"lifespanInSeconds": "3600"
|
||||
}
|
||||
|
||||
Response:
|
||||
|
||||
http (json):
|
||||
"5f33b4bd-dc2a-4ace-947a-1aadc6045995"
|
||||
|
||||
|
||||
### `GET /receive`
|
||||
|
||||
Receives all waiting messages.
|
||||
|
||||
Request:
|
||||
|
||||
http /receive (get) header: Authorization: Bearer 81ccf737-d424-4f83-929c-92d20491abfa
|
||||
|
||||
Response
|
||||
Response:
|
||||
|
||||
http (json):
|
||||
"messages": [
|
||||
@ -124,6 +135,39 @@ Response
|
||||
}
|
||||
]
|
||||
|
||||
### `POST /ack`
|
||||
|
||||
Acknowledges delivered message. The client that received the message is the only party able to acknowledge.
|
||||
|
||||
Request:
|
||||
|
||||
http /ack (post) header: Authorization: Bearer 81ccf737-d424-4f83-929c-92d20491abfa
|
||||
{
|
||||
"messageId": "5f33b4bd-dc2a-4ace-947a-1aadc6045995"
|
||||
}
|
||||
|
||||
Response:
|
||||
|
||||
http (json) 200 OK:
|
||||
(empty)
|
||||
|
||||
### `GET /verify`
|
||||
|
||||
Sender can call this to get delivery status of message that has been sent earlier:
|
||||
|
||||
Request:
|
||||
|
||||
http /verify?messageId=5f33b4bd-dc2a-4ace-947a-1aadc6045995 (get) header: Authorization: Bearer 81ccf737-d424-4f83-929c-92d20491abfa
|
||||
|
||||
Response:
|
||||
|
||||
http (json) 200 OK:
|
||||
{
|
||||
"isDelivered": true,
|
||||
"isAcknowledged": true
|
||||
}
|
||||
|
||||
|
||||
## Testing
|
||||
|
||||
See postman collection to generate code for your desired language or test the API instance. The collection also works as test suite, just fill out the environment variables for URL and api keys of your users and it will run and test all endpoints, with expected outputs.
|
||||
Reference in New Issue
Block a user