Welcome to Toastmasters API documentation.
brew install postgres
(>= 9.4)rbenv install 2.2.2; rbenv global 2.2.2
gem install bundler foreman
bundle install
createdb toastmasters; bundle exec rake db:migrate
foreman start
The format used for requests and responses is JSON API, with the media type application/vnd.api+json. Every request requires HTTP basic authentication:
GET /meetings HTTP/1.1
Authorization: Basic dG9hc3RtYXN0ZXJzOnNlY3JldA==
Errors that happen in the request will be returned, and sometimes the "meta" key will return error data:
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"errors": [
{
"id": "unauthorized",
"title": "The request requires authentication",
"status": 401,
"meta": {}
}
]
}
Attribute | Type |
---|---|
id |
string |
date |
date |
note |
string |
When singular meetings are returned, a list of participations will also be returned.
GET /meetings HTTP/1.1
GET /meetings/43 HTTP/1.1
POST /meetings HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "meetings",
"attributes": {
"date": "2015-01-01",
}
}
}
PATCH /meetings/43 HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "meetings",
"id": "43",
"attributes": {
"note": "A note about the meeting",
}
}
}
DELETE /meetings/43 HTTP/1.1
Attribute | Type |
---|---|
id |
string |
first_name |
string |
last_name |
string |
email |
string |
active |
boolean |
GET /members HTTP/1.1
GET /members/43 HTTP/1.1
POST /members HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "members",
"attributes": {
"first_name": "John",
"last_name": "Smith",
"email": "[email protected]",
}
}
}
PATCH /members/43 HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "members",
"id": "43",
"attributes": {
"active": false,
}
}
}
DELETE /members/43 HTTP/1.1
GET /members/43/speeches HTTP/1.1
This will list all of member's speeches in chronological order.
Attribute | Type |
---|---|
id |
string |
first_name |
string |
last_name |
string |
email |
string |
GET /guests HTTP/1.1
GET /guests/43 HTTP/1.1
POST /guests HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "guests",
"attributes": {
"first_name": "John",
"last_name": "Smith",
"email": "[email protected]",
}
}
}
If a guest already exists with given attributes, returns it rather than creating a new one.
PATCH /guests/43 HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "guests",
"id": "43",
"attributes": {
"first_name": "Edward",
}
}
}
DELETE /guests/43 HTTP/1.1
Attribute | Type |
---|---|
id |
string |
role |
string |
role_data |
json |
Valid roles are:
role |
role_data |
---|---|
Toastmaster |
|
General Evaluator |
|
Speaker |
{"speech_id": "123"} |
Evaluator |
{"speaker_id": "22"} |
Table TopicsMaster |
|
Timer |
|
Grammarian |
|
Ah-Counter |
Participations have associations meeting
, member
and guest
.
GET /meetings/12/participations HTTP/1.1
POST /meetings/12/participations HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "participations",
"attributes": {
"role": "Evaluator",
"role_data": {}
},
"relationships": {
"member": {
"data": {"type": "members", "id": "25"}
}
}
}
}
We can create either a "member" or a "guest" participation by putting the appropriate name in "relationships".
{"relationships": {"member": {"data": {"type": "members", "id": "25"}}}}
{"relationships": {"guest": {"data": {"type": "guests", "id": "42"}}}}
PATCH /meetings/12/participations/43 HTTP/1.1
Content-Type: application/json
{
"data": {
"type": "participations",
"id": "43",
"attributes": {
"role_data": {"speaker_id": 22},
}
}
}
DELETE /meetings/12/participations/43 HTTP/1.1
Attribute | Type |
---|---|
id |
string |
title |
string |
number |
integer |
GET /speeches HTTP/1.1
HTTP/1.1 200 OK
Content-Type: application/json
{
"data": [{
"type": "speeches",
"id": "25",
"attributes": {
"title": "How to Say it",
"number": 4
},
"relationships": {
"manual": {
"data": {"type": "manuals", "id": "7"}
}
}
}],
"included": [{
"type": "manuals",
"id": "7",
"attributes": {
"name": "Competent Communicator"
}
}]
}