{"mock":"https://private-anon-37074ff814-jmtargetmvd.apiary-mock.com","proxy":"https://private-anon-37074ff814-jmtargetmvd.apiary-proxy.com"}
FORMAT: 1A
# Target MVD
# Group Auth
## Registrations [/auth]
+ Attributes (object)
+ email (required) - Email
+ full_name (required) - Full name
+ gender (required) - Gender
+ password (required) - Password
+ current_password (required) - Current password
### Create [POST]
+ Request Bad
+ Body
{"email":"","full_name":"John Lennon 2","gender":"male","password":"P@55word"}
+ Response 422 ()
+ Body
{
"errors": [
{
"source": {
"pointer": "/data/attributes/email"
},
"detail": "can't be blank"
}
]
}
+ Request Ok
+ Body
{"email":"user-1@example.com","full_name":"John Lennon 1","gender":"male","password":"P@55word"}
+ Response 201 ()
+ Body
{
"data": {
"id": "1",
"type": "users",
"attributes": {
"avatar-url": null,
"email": "user-1@example.com",
"full-name": "John Lennon 1",
"gender": "male"
},
"relationships": {
"targets": {
"data": [
]
}
}
}
}
### Update [PUT]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-3@example.com
+ Body
{"current_password":"P@55word","email":"new-email-1@example.com","password":"n3w-p@55word"}
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: new-email-1@example.com
+ Body
{
"data": {
"id": "2",
"type": "users",
"attributes": {
"avatar-url": null,
"email": "new-email-1@example.com",
"full-name": "John Lennon 3",
"gender": "male"
},
"relationships": {
"targets": {
"data": [
]
}
}
}
}
## Session [/auth/sign_in]
+ Attributes (object)
+ email (required) - Email
+ password (required) - Password
### Create [POST]
+ Request Ok
+ Body
{"email":"user-4@example.com","password":"P@55word"}
+ Response 200 ()
+ Headers
access-token: 1234567890123456789012
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry: 1559917653
uid: user-4@example.com
+ Body
{
"data": {
"id": 3,
"email": "user-4@example.com",
"provider": "email",
"full_name": "John Lennon 4",
"uid": "user-4@example.com",
"allow_password_change": false,
"gender": "male",
"type": "user"
}
}
## Session [/auth/sign_out]
### Delete [DELETE]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-5@example.com
+ Response 200 ()
+ Body
{
"success": true
}
## Password [/auth/password]
+ Attributes (object)
+ email (required) - Email
+ redirect_url (required) - Url to which the user will be redirected after visiting
the link contained in the email
+ password (required) - New password
+ password_confirmation (required) - Confirm new password
### Reset password email [POST]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-6@example.com
+ Body
{"email":"user-6@example.com","redirect_url":"http://anywhere.com"}
+ Response 200 ()
+ Body
{
"success": true,
"message": "An email has been sent to 'user-6@example.com' containing instructions for resetting your password."
}
### Update password [PUT]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-7@example.com
+ Body
{"password":"new-p@55word","password_confirmation":"new-p@55word"}
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-7@example.com
+ Body
{
"success": true,
"data": {
"id": 6,
"provider": "email",
"allow_password_change": false,
"email": "user-7@example.com",
"full_name": "John Lennon 7",
"uid": "user-7@example.com",
"created_at": "2019-05-24T14:27:33.522Z",
"updated_at": "2019-05-24T14:27:33.623Z",
"gender": "male",
"type": "user"
},
"message": "Your password has been successfully updated."
}
## Facebook [/auth/facebook/callback]
+ Attributes (object)
+ access_token (required) - Access token provided by facebook
### Login or Sign up [POST]
+ Request Ok
+ Body
{"facebook":{"access_token":"acc35T0k3n"}}
+ Response 200 ()
+ Headers
access-token: 1234567890123456789012
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry: 1559917653
uid: existing-user@example.com
+ Body
{
"data": {
"id": "7",
"type": "users",
"attributes": {
"avatar-url": null,
"email": "existing-user@example.com",
"full-name": "Juan Manuel Ramallo",
"gender": "unset"
},
"relationships": {
"targets": {
"data": [
]
}
}
}
}
## Cable [/auth/cable]
### Authorization ticket for websocket connection [POST]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-8@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-8@example.com
+ Body
{
"data": {
"id": "ticket",
"type": "tickets",
"attributes": {
"value": "eyJ1c2VyX2lkIjo4LCJpcCI6IjEyNy4wLjAuMSIsImNyZWF0ZWRfYXQiOiIyMDE5LTA1LTI0VDE0OjI3OjMzLjgxMloifQ=="
}
}
}
# Group Compatible targets
## Compatible targets collection [/compatible_targets]
### Index [GET]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-9@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-9@example.com
+ Body
{
"data": [
{
"id": "2",
"type": "targets",
"attributes": {
"area-length": 2000,
"lat": -86.5917498575336,
"lng": -68.6073074278556,
"title": "Wilburn Runolfsdottir"
},
"relationships": {
"topic": {
"data": {
"id": "1",
"type": "topics"
}
},
"user": {
"data": {
"id": "10",
"type": "users"
}
}
}
}
]
}
# Group Conversations
## Conversations collection [/conversations]
+ Attributes (object)
+ target_id (required) - Target associated to the conversation
### Create [POST]
+ Request Bad
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-16@example.com
+ Body
{"conversation":{"target_id":12}}
+ Response 422 ()
+ Body
{
"errors": [
{
"source": {
"pointer": "/data/attributes/target"
},
"detail": "must be compatible with initiator"
},
{
"source": {
"pointer": "/data/attributes/target"
},
"detail": "must not belong to the initiator"
}
]
}
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-11@example.com
+ Body
{"conversation":{"target_id":11}}
+ Response 201 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-11@example.com
+ Body
{
"data": {
"id": "4",
"type": "conversations",
"attributes": {
"unread": true,
"status": "active"
},
"relationships": {
"initiator": {
"data": {
"id": "11",
"type": "users"
}
},
"target": {
"data": {
"id": "11",
"type": "targets"
}
}
}
}
}
### Index [GET]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-21@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-21@example.com
+ Body
{
"data": [
{
"id": "8",
"type": "conversations",
"attributes": {
"unread": false,
"status": "active"
},
"relationships": {
"initiator": {
"data": {
"id": "21",
"type": "users"
}
},
"target": {
"data": {
"id": "22",
"type": "targets"
}
}
}
},
{
"id": "9",
"type": "conversations",
"attributes": {
"unread": false,
"status": "active"
},
"relationships": {
"initiator": {
"data": {
"id": "21",
"type": "users"
}
},
"target": {
"data": {
"id": "23",
"type": "targets"
}
}
}
},
{
"id": "10",
"type": "conversations",
"attributes": {
"unread": false,
"status": "active"
},
"relationships": {
"initiator": {
"data": {
"id": "21",
"type": "users"
}
},
"target": {
"data": {
"id": "24",
"type": "targets"
}
}
}
},
{
"id": "11",
"type": "conversations",
"attributes": {
"unread": false,
"status": "active"
},
"relationships": {
"initiator": {
"data": {
"id": "21",
"type": "users"
}
},
"target": {
"data": {
"id": "25",
"type": "targets"
}
}
}
}
]
}
## Conversation member [/conversations/{id}]
+ Attributes (object)
+ unread (required) - Flag to mark the conversation as unread
### Show [GET]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-26@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-26@example.com
+ Body
{
"data": {
"id": "12",
"type": "conversations",
"attributes": {
"unread": false,
"status": "active"
},
"relationships": {
"initiator": {
"data": {
"id": "26",
"type": "users"
}
},
"target": {
"data": {
"id": "27",
"type": "targets"
}
}
}
}
}
### Update [PUT]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-31@example.com
+ Body
{"conversation":{"unread":false}}
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-31@example.com
+ Body
{
"data": {
"id": "16",
"type": "conversations",
"attributes": {
"unread": false,
"status": "active"
},
"relationships": {
"initiator": {
"data": {
"id": "31",
"type": "users"
}
},
"target": {
"data": {
"id": "32",
"type": "targets"
}
}
}
}
}
# Group Messages
## Messages collection [/conversations/{conversation_id}/messages]
+ Attributes (object)
+ text (required) - Message to send
### Create [POST]
+ Request Bad
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-38@example.com
+ Body
{"message":{"text":""}}
+ Response 422 ()
+ Body
{
"errors": [
{
"source": {
"pointer": "/data/attributes/text"
},
"detail": "can't be blank"
}
]
}
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-36@example.com
+ Body
{"message":{"text":"Man is driven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software."}}
+ Response 201 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-36@example.com
+ Body
{
"data": {
"id": "16",
"type": "messages",
"attributes": {
"text": "Man is driven to create; I know I really love to create things. And while I'm not good at painting, drawing, or music, I can write software.",
"created-at": "2019-05-24T14:27:35.011Z"
},
"relationships": {
"conversation": {
"data": {
"id": "20",
"type": "conversations"
}
},
"user": {
"data": {
"id": "36",
"type": "users"
}
}
}
}
}
### Index [GET]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-40@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-40@example.com
+ Body
{
"data": [
{
"id": "22",
"type": "messages",
"attributes": {
"text": "Smart people underestimate the ordinarity of ordinary people.",
"created-at": "2019-05-24T14:27:35.179Z"
},
"relationships": {
"conversation": {
"data": {
"id": "22",
"type": "conversations"
}
},
"user": {
"data": {
"id": "40",
"type": "users"
}
}
}
},
{
"id": "23",
"type": "messages",
"attributes": {
"text": "Most of the tasks we do are for humans. For example, a tax calculation is counting numbers so the government can pull money out from my wallet, but government consists of humans.",
"created-at": "2019-05-24T14:27:35.180Z"
},
"relationships": {
"conversation": {
"data": {
"id": "22",
"type": "conversations"
}
},
"user": {
"data": {
"id": "41",
"type": "users"
}
}
}
},
{
"id": "24",
"type": "messages",
"attributes": {
"text": "I didn't work hard to make Ruby perfect for everyone, because you feel differently from me. No language can be perfect for everyone. I tried to make Ruby perfect for me, but maybe it's not perfect for you. The perfect language for Guido van Rossum is probably Python.",
"created-at": "2019-05-24T14:27:35.182Z"
},
"relationships": {
"conversation": {
"data": {
"id": "22",
"type": "conversations"
}
},
"user": {
"data": {
"id": "40",
"type": "users"
}
}
}
},
{
"id": "25",
"type": "messages",
"attributes": {
"text": "I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language.",
"created-at": "2019-05-24T14:27:35.184Z"
},
"relationships": {
"conversation": {
"data": {
"id": "22",
"type": "conversations"
}
},
"user": {
"data": {
"id": "41",
"type": "users"
}
}
}
},
{
"id": "26",
"type": "messages",
"attributes": {
"text": "I didn't work hard to make Ruby perfect for everyone, because you feel differently from me. No language can be perfect for everyone. I tried to make Ruby perfect for me, but maybe it's not perfect for you. The perfect language for Guido van Rossum is probably Python.",
"created-at": "2019-05-24T14:27:35.185Z"
},
"relationships": {
"conversation": {
"data": {
"id": "22",
"type": "conversations"
}
},
"user": {
"data": {
"id": "40",
"type": "users"
}
}
}
}
]
}
# Group Targets
## Targets collection [/targets]
+ Attributes (object)
+ area_length (required) - Area length (meters)
+ lat (required) - Latitude
+ lng (required) - Longitude
+ title (required) - Title
+ topic_id (required) - Topic ID
### Create [POST]
+ Request Bad
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-45@example.com
+ Body
{"target":{"area_length":711,"lat":52.94819118357151,"lng":64.80483783436537,"title":"","topic_id":25}}
+ Response 422 ()
+ Body
{
"errors": [
{
"source": {
"pointer": "/data/attributes/title"
},
"detail": "can't be blank"
}
]
}
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-43@example.com
+ Body
{"target":{"area_length":323,"lat":-29.728731250694544,"lng":150.74420224924438,"title":"Dianna Schultz","topic_id":22}}
+ Response 201 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-43@example.com
+ Body
{
"data": {
"id": "47",
"type": "targets",
"attributes": {
"area-length": 323,
"lat": -29.728731250694544,
"lng": 150.74420224924438,
"title": "Dianna Schultz"
},
"relationships": {
"topic": {
"data": {
"id": "22",
"type": "topics"
}
},
"user": {
"data": {
"id": "43",
"type": "users"
}
}
}
}
}
### Index [GET]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-42@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-42@example.com
+ Body
{
"data": [
{
"id": "42",
"type": "targets",
"attributes": {
"area-length": 835,
"lat": 6.0910926100098,
"lng": -56.3897233879792,
"title": "Ms. Elton Gorczany"
},
"relationships": {
"topic": {
"data": {
"id": "18",
"type": "topics"
}
},
"user": {
"data": {
"id": "42",
"type": "users"
}
}
}
},
{
"id": "43",
"type": "targets",
"attributes": {
"area-length": 891,
"lat": 4.455688628871,
"lng": 154.205738430685,
"title": "Saturnina Runolfsson"
},
"relationships": {
"topic": {
"data": {
"id": "19",
"type": "topics"
}
},
"user": {
"data": {
"id": "42",
"type": "users"
}
}
}
}
]
}
## Target member [/targets/{id}]
+ Attributes (object)
+ area_length (required) - Area length (meters)
+ lat (required) - Latitude
+ lng (required) - Longitude
+ title (required) - Title
+ topic_id (required) - Topic ID
### Destroy [DELETE]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-47@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-47@example.com
+ Body
{
"data": {
"id": "53",
"type": "targets",
"attributes": {
"area-length": 755,
"lat": 4.91845049407466,
"lng": 109.363503650676,
"title": "Donn Ullrich Jr."
},
"relationships": {
"topic": {
"data": {
"id": "28",
"type": "topics"
}
},
"user": {
"data": {
"id": "47",
"type": "users"
}
}
}
}
}
### Update [PUT]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-48@example.com
+ Body
{"target":{"area_length":761,"lat":81.14695851175449,"lng":-121.59257841171197,"title":"Alverta Champlin","topic_id":32}}
+ Response 202 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-48@example.com
+ Body
{
"data": {
"id": "56",
"type": "targets",
"attributes": {
"area-length": 761,
"lat": 81.14695851175449,
"lng": -121.59257841171197,
"title": "Alverta Champlin"
},
"relationships": {
"topic": {
"data": {
"id": "32",
"type": "topics"
}
},
"user": {
"data": {
"id": "48",
"type": "users"
}
}
}
}
}
# Group Topics
## Topics collection [/topics]
### Index [GET]
+ Request Ok
+ Headers
Access-Token: 1234567890123456789012
Client: abcdefghijklmnopqrstuv
Uid: user-50@example.com
+ Response 200 ()
+ Headers
access-token:
token-type: Bearer
client: abcdefghijklmnopqrstuv
expiry:
uid: user-50@example.com
+ Body
{
"data": [
{
"id": "33",
"type": "topics",
"attributes": {
"name": "Dr. Josiah Marquardt"
},
"relationships": {
"targets": {
"data": [
]
}
}
},
{
"id": "34",
"type": "topics",
"attributes": {
"name": "Dr. Leopoldo Purdy"
},
"relationships": {
"targets": {
"data": [
]
}
}
},
{
"id": "35",
"type": "topics",
"attributes": {
"name": "Alita Williamson"
},
"relationships": {
"targets": {
"data": [
]
}
}
}
]
}