[ { "type": "post", "url": "/activate", "title": "Activate registered user", "version": "1.0.0", "name": "ActivateUser", "group": "Users", "permission": [ { "name": "none" } ], "description": "

Attempts to activate the user, and, if successful, returns authentication token and activated user info

", "parameter": { "fields": { "Query": [ { "group": "Query", "type": "

String

", "optional": false, "field": "token", "description": "

Token from the user's email

" } ] } }, "examples": [ { "title": "Example usage:", "content": "curl -i -X POST -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' -H 'Accept-Encoding: gzip, deflate' \\\n \"https://api-users.sandbox.matic.ninja/api/users/activate?token=xxx\"", "type": "curl" } ], "filename": "src/endpoints/activate.js", "groupTitle": "Users", "success": { "fields": { "Code 200": [ { "group": "Code 200", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.jwt", "description": "

jsonwebtoken to be used for further authentication

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data", "description": "

response data

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.type", "description": "

response data type - always user

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.id", "description": "

username, always an email

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

user attributes

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.links", "description": "

user links

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.links.self", "description": "

link to the user resource

" } ] }, "examples": [ { "title": "Success-User:", "content": "HTTP/1.1 200 OK\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\",\n\t\t\"jwt\": \"jsonwebtoken\"\n\t},\n\t\"data\": {\n\t\t\"type\": \"user\",\n\t\t\"id\": \"user@example.com\",\n\t\t\"attributes\": {\n\t\t\t\"firstName\": \"Anna\",\n\t\t\t\"lastName\": \"Maria\"\n\t\t},\n\t\t\"links\": {\n\t\t\t\"self\": \"https://localhost:443/api/users/user%40example.com\"\n\t\t}\n\t}\n}", "type": "json" } ] }, "error": { "fields": { "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ] }, "examples": [ { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" } ] } }, { "type": "patch", "url": "/:id/ban", "title": "Bans or unbans specified user", "version": "1.0.0", "name": "BanUser", "group": "Users", "permission": [ { "name": "admin" } ], "description": "

Locks or unlocks account of the specified user based on the body payload

", "header": { "fields": { "Authorization": [ { "group": "Authorization", "type": "String", "optional": false, "field": "Authorization", "description": "

JWT :accessToken

" } ] }, "examples": [ { "title": "Authorization-Example:", "content": "\"Authorization: JWT myreallyniceandvalidjsonwebtoken\"", "type": "json" } ] }, "parameter": { "fields": { "Params": [ { "group": "Params", "type": "

String

", "optional": false, "field": "id", "description": "

username we are trying to lock/unlock

" } ], "Body": [ { "group": "Body", "type": "

Object

", "optional": false, "field": "data", "description": "

container

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

we are modifying this object type, must be 'user'

" }, { "group": "Body", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

container for attributes

" }, { "group": "Body", "type": "

Boolean

", "optional": false, "field": "data.attributes.ban", "description": "

when true - locks account, when false - unlocks it

" }, { "group": "Body", "type": "

String

", "size": "1..", "optional": true, "field": "data.attributes.reason", "description": "

optional reason for this action

" } ] } }, "examples": [ { "title": "Example usage:", "content": "curl -i -X PATCH -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' -H 'Authorization: JWT realjwttoken' \\\n -H 'Content-Type: application/vnd.api+json' \\\n \"https://api-users.sandbox.matic.ninja/api/users/v%40example.com/ban\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"attributes\": {\n \"ban\": true,\n \"reason\": \"fraudulent activity\"\n }\n }\n }'", "type": "curl" } ], "success": { "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 204 No Content", "type": "json" } ] }, "filename": "src/endpoints/ban.js", "groupTitle": "Users", "error": { "fields": { "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ], "Code 401": [ { "group": "Code 401", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 401", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 404": [ { "group": "Code 404", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 404", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" }, { "title": "UnauthorizedError:", "content": "HTTP/1.1 401 Unauthorized\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 401,\n\t\t\"title\": \"you must authorize to use this endpoint\",\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" }, { "title": "UserNotFoundError:", "content": "HTTP/1.1 404 NotFound\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 404,\n\t\t\"title\": \"user test@example.com not found\",\n\t}]\n}", "type": "json" } ] } }, { "type": "get", "url": "/:id", "title": "Get user object", "version": "1.0.0", "name": "GetUser", "group": "Users", "permission": [ { "name": "admin" } ], "description": "

Returns user object and it's metadata by user'd id

", "header": { "fields": { "Authorization": [ { "group": "Authorization", "type": "String", "optional": false, "field": "Authorization", "description": "

JWT :accessToken

" } ] }, "examples": [ { "title": "Authorization-Example:", "content": "\"Authorization: JWT myreallyniceandvalidjsonwebtoken\"", "type": "json" } ] }, "parameter": { "fields": { "Params": [ { "group": "Params", "type": "

String

", "optional": false, "field": "id", "description": "

username to be returned

" } ] } }, "examples": [ { "title": "Example usage:", "content": "curl -i -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' -H \"Authorization: JWT realjwttoken\" \\\n \"https://api-users.sandbox.matic.ninja/api/users/v%40example.com\"", "type": "curl" } ], "success": { "fields": { "Code 200": [ { "group": "Code 200", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data", "description": "

response data

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.type", "description": "

response data type - always user

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.id", "description": "

username, always an email

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

user attributes

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.links", "description": "

user links

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.links.self", "description": "

link to the user resource

" } ] }, "examples": [ { "title": "Success-User:", "content": "HTTP/1.1 200 OK\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\",\n\t},\n\t\"data\": {\n\t\t\"type\": \"user\",\n\t\t\"id\": \"user@example.com\",\n\t\t\"attributes\": {\n\t\t\t\"firstName\": \"Anna\",\n\t\t\t\"lastName\": \"Maria\"\n\t\t},\n\t\t\"links\": {\n\t\t\t\"self\": \"https://localhost:443/api/users/user%40example.com\"\n\t\t}\n\t}\n}", "type": "json" } ] }, "filename": "src/endpoints/get.js", "groupTitle": "Users", "error": { "fields": { "Code 401": [ { "group": "Code 401", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 401", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 404": [ { "group": "Code 404", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 404", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "UnauthorizedError:", "content": "HTTP/1.1 401 Unauthorized\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 401,\n\t\t\"title\": \"you must authorize to use this endpoint\",\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" }, { "title": "UserNotFoundError:", "content": "HTTP/1.1 404 NotFound\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 404,\n\t\t\"title\": \"user test@example.com not found\",\n\t}]\n}", "type": "json" } ] } }, { "type": "get", "url": "/", "title": "List user objects", "version": "1.0.0", "name": "GetUserObjects", "group": "Users", "permission": [ { "name": "admin" } ], "description": "

Returns list of user objects, allows filtering by multiple metadata fields, sorting by a single field in ASC/DESC fashion and paginating over them

", "header": { "fields": { "Authorization": [ { "group": "Authorization", "type": "String", "optional": false, "field": "Authorization", "description": "

JWT :accessToken

" } ] }, "examples": [ { "title": "Authorization-Example:", "content": "\"Authorization: JWT myreallyniceandvalidjsonwebtoken\"", "type": "json" } ] }, "examples": [ { "title": "Example usage:", "content": "curl -i -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' -H \"Authorization: JWT realjwttoken\" \\\n \"https://api-users.sandbox.matic.ninja/api/users\"", "type": "curl" } ], "parameter": { "fields": { "Query": [ { "group": "Query", "type": "

Number

", "size": "0..", "optional": true, "field": "offset", "description": "

how many users to skip

" }, { "group": "Query", "type": "

Number

", "size": "1..100", "optional": true, "field": "limit", "description": "

how many users to return per page

" }, { "group": "Query", "type": "

String

", "optional": true, "field": "filter", "description": "

encodeURIComponent(JSON.stringify(filterObject)), pass it as value. # - filters by username, other keys - by allowed metadata

" }, { "group": "Query", "type": "

String

", "optional": true, "field": "sortBy", "description": "

encodeURIComponent(sortBy), if not specified, sorts by username, otherwise by metadata field passed here

" }, { "group": "Query", "type": "

String

", "allowedValues": [ "\"ASC\"", "\"DESC\"" ], "optional": true, "field": "order", "description": "

sorting order, defaults to "ASC", case-insensitive

" } ] } }, "success": { "fields": { "Code 200": [ { "group": "Code 200", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 200", "type": "

Number

", "optional": false, "field": "meta.page", "description": "

current page we are looking at

" }, { "group": "Code 200", "type": "

Number

", "optional": false, "field": "meta.pages", "description": "

total number of pages

" }, { "group": "Code 200", "type": "

Number

", "optional": false, "field": "meta.cursor", "description": "

set as offset for the next page

" }, { "group": "Code 200", "type": "

Object[]

", "optional": false, "field": "data", "description": "

response data

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.type", "description": "

response data type - always user

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.id", "description": "

username, always an email

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

user attributes

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.links", "description": "

user links

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.links.self", "description": "

link to the current resource

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "links", "description": "

links

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "links.self", "description": "

link to the current page

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "links.next", "description": "

link to the next page

" } ] }, "examples": [ { "title": "Success-Users:", "content": "HTTP/1.1 200 OK\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\",\n\t\t\"page\": 10,\n\t\t\"pages\": 10\n\t},\n\t\"data\": [{\n\t\t\"type\": \"user\",\n\t\t\"id\": \"user@example.com\",\n\t\t\"attributes\": {\n\t\t\t\"firstName\": \"Anna\",\n\t\t\t\"lastName\": \"Maria\"\n\t\t},\n\t\t\"links\": {\n\t\t\t\"self\": \"https://localhost:443/api/users/user%40example.com\"\n\t\t}\n\t}],\n\t\"links\": {\n\t\t\"self\": \"https://localhost:443/api/users?cursor=91&limit=10\"\n\t}\n}", "type": "json" } ] }, "filename": "src/endpoints/list.js", "groupTitle": "Users", "error": { "fields": { "Code 401": [ { "group": "Code 401", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 401", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ] }, "examples": [ { "title": "UnauthorizedError:", "content": "HTTP/1.1 401 Unauthorized\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 401,\n\t\t\"title\": \"you must authorize to use this endpoint\",\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" }, { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" } ] } }, { "type": "post", "url": "/login", "title": "Sign in", "version": "1.0.0", "name": "Login", "group": "Users", "permission": [ { "name": "none" } ], "description": "

Authenticates user via it's username and password. Returns JWT token and associated user object on success.

", "parameter": { "fields": { "Body": [ { "group": "Body", "type": "

Object

", "optional": false, "field": "data", "description": "

data container

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

data type

" }, { "group": "Body", "type": "

String

", "optional": false, "field": "data.id", "description": "

username

" }, { "group": "Body", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

data attributes container

" }, { "group": "Body", "type": "

String

", "optional": false, "field": "data.attributes.password", "description": "

user password

" } ] } }, "examples": [ { "title": "Example usage:", "content": "curl -i -X POST -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n \"https://api-users.sandbox.matic.ninja/api/users/login\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"id\": \"v@example.com\",\n \"attributes\": {\n \"password\": \"somerealpassword\"\n }\n }\n }'", "type": "curl" } ], "filename": "src/endpoints/login.js", "groupTitle": "Users", "error": { "fields": { "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 404": [ { "group": "Code 404", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 404", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 423": [ { "group": "Code 423", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 423", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 429": [ { "group": "Code 429", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 429", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" }, { "title": "UserNotFoundError:", "content": "HTTP/1.1 404 NotFound\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 404,\n\t\t\"title\": \"user test@example.com not found\",\n\t}]\n}", "type": "json" }, { "title": "LockedError:", "content": "HTTP/1.1 423 Locked\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 423,\n\t\t\"title\": \"account has been locked\",\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 429 Too Many Requests\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 429,\n\t\t\"title\": \"you have requested to perform this action too many times\",\n\t}]\n}", "type": "json" } ] }, "success": { "fields": { "Code 200": [ { "group": "Code 200", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.jwt", "description": "

jsonwebtoken to be used for further authentication

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data", "description": "

response data

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.type", "description": "

response data type - always user

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.id", "description": "

username, always an email

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

user attributes

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.links", "description": "

user links

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.links.self", "description": "

link to the user resource

" } ] }, "examples": [ { "title": "Success-User:", "content": "HTTP/1.1 200 OK\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\",\n\t\t\"jwt\": \"jsonwebtoken\"\n\t},\n\t\"data\": {\n\t\t\"type\": \"user\",\n\t\t\"id\": \"user@example.com\",\n\t\t\"attributes\": {\n\t\t\t\"firstName\": \"Anna\",\n\t\t\t\"lastName\": \"Maria\"\n\t\t},\n\t\t\"links\": {\n\t\t\t\"self\": \"https://localhost:443/api/users/user%40example.com\"\n\t\t}\n\t}\n}", "type": "json" } ] } }, { "type": "get", "url": "/me", "title": "Returns currently authorized user", "version": "1.0.0", "name": "Me", "group": "Users", "permission": [ { "name": "user" } ], "description": "

Returns user object associated with a current authorization token

", "header": { "fields": { "Authorization": [ { "group": "Authorization", "type": "String", "optional": false, "field": "Authorization", "description": "

JWT :accessToken

" } ] }, "examples": [ { "title": "Authorization-Example:", "content": "\"Authorization: JWT myreallyniceandvalidjsonwebtoken\"", "type": "json" } ] }, "examples": [ { "title": "Example usage:", "content": "curl -i -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n -H 'Authroziation: JWT myrealjwttoken' \\\n \"https://api-users.sandbox.matic.ninja/api/users/me\" \\", "type": "curl" } ], "filename": "src/endpoints/me.js", "groupTitle": "Users", "error": { "fields": { "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ], "Code 401": [ { "group": "Code 401", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 401", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" }, { "title": "UnauthorizedError:", "content": "HTTP/1.1 401 Unauthorized\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 401,\n\t\t\"title\": \"you must authorize to use this endpoint\",\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" } ] }, "success": { "fields": { "Code 200": [ { "group": "Code 200", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "meta.jwt", "description": "

jsonwebtoken to be used for further authentication

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data", "description": "

response data

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.type", "description": "

response data type - always user

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.id", "description": "

username, always an email

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

user attributes

" }, { "group": "Code 200", "type": "

Object

", "optional": false, "field": "data.links", "description": "

user links

" }, { "group": "Code 200", "type": "

String

", "optional": false, "field": "data.links.self", "description": "

link to the user resource

" } ] }, "examples": [ { "title": "Success-User:", "content": "HTTP/1.1 200 OK\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\",\n\t\t\"jwt\": \"jsonwebtoken\"\n\t},\n\t\"data\": {\n\t\t\"type\": \"user\",\n\t\t\"id\": \"user@example.com\",\n\t\t\"attributes\": {\n\t\t\t\"firstName\": \"Anna\",\n\t\t\t\"lastName\": \"Maria\"\n\t\t},\n\t\t\"links\": {\n\t\t\t\"self\": \"https://localhost:443/api/users/user%40example.com\"\n\t\t}\n\t}\n}", "type": "json" } ] } }, { "type": "post", "url": "/", "title": "Registers new user", "version": "1.0.0", "name": "Register", "group": "Users", "permission": [ { "name": "none" } ], "description": "

Registers user in the system and send email validation request, so that the user can activate the account

", "parameter": { "fields": { "Body": [ { "group": "Body", "type": "

Object

", "optional": false, "field": "data", "description": "

data container

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

data type

" }, { "group": "Body", "type": "

String

", "size": "6..50", "optional": false, "field": "data.id", "description": "

new username, always an email

" }, { "group": "Body", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

attributes container

" }, { "group": "Body", "type": "

String

", "size": "6..50", "optional": false, "field": "data.attributes.password", "description": "

user's password

" }, { "group": "Body", "type": "

String

", "size": "6..50", "optional": false, "field": "data.attributes.passwordRepeat", "description": "

make sure that user typed in the same password

" }, { "group": "Body", "type": "

String

", "size": "1..150", "optional": false, "field": "data.attributes.firstName", "description": "

user's given name

" }, { "group": "Body", "type": "

String

", "size": "1..150", "optional": false, "field": "data.attributes.lastName", "description": "

user's surname

" }, { "group": "Body", "type": "

String

", "size": "1..150", "optional": false, "field": "data.attributes.companyName", "description": "

user's company name

" }, { "group": "Body", "type": "

String

", "size": "3", "optional": true, "field": "data.attributes.country", "description": "

ISO3 country code, e.g "USA" or "RUS"

" }, { "group": "Body", "type": "

String

", "size": "1..150", "optional": true, "field": "data.attributes.city", "description": "

free-form input city name

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"female\"", "\"male\"", "\"other\"" ], "optional": true, "field": "data.attributes.gender", "description": "

user's gender

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"YYYY.MM.DD\"" ], "optional": true, "field": "data.attributes.birthday", "description": "

birthday in the format of YYYY.MM.DD

" }, { "group": "Body", "type": "

String

", "size": "6..20", "optional": true, "field": "data.attributes.phone", "description": "

user's phone, no validation

" } ] } }, "examples": [ { "title": "Example usage:", "content": "curl -i -X POST -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n \"https://api-sandbox.cappasity.matic.ninja/api/users\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"id\": \"v@example.com\",\n \"attributes\": {\n \"password\": \"somerealpassword\",\n \"passwordRepeat\": \"somerealpassword\",\n \"firstName\": \"Vitaly\",\n \"lastName\": \"Nordstrom\",\n \"companyName\": \"LasVatos, LLC\",\n \"country\": \"USA\",\n \"city\": \"Las Vegas\",\n \"gender\": \"male\",\n \"birthday\": \"1934.09.25\",\n \"phone\": \"(440)0000000\"\n }\n }\n }'", "type": "curl" } ], "success": { "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 202 Accepted", "type": "json" } ] }, "filename": "src/endpoints/register.js", "groupTitle": "Users", "error": { "fields": { "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ], "Code 412": [ { "group": "Code 412", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 412", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 429": [ { "group": "Code 429", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 429", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 412 Precondition Failed\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 412,\n\t\t\"title\": \"user is already active\",\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 429 Too Many Requests\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 429,\n\t\t\"title\": \"you have requested to perform this action too many times\",\n\t}]\n}", "type": "json" } ] } }, { "type": "post", "url": "/reset", "title": "Request to reset password", "version": "1.0.0", "name": "RequestToResetPassword", "group": "Users", "permission": [ { "name": "none" } ], "description": "

Requests an email to reset user's password

", "parameter": { "fields": { "Body": [ { "group": "Body", "type": "

Object

", "optional": false, "field": "data", "description": "

data container

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

data type

" }, { "group": "Body", "type": "

String

", "optional": false, "field": "data.id", "description": "

username

" } ] } }, "examples": [ { "title": "Example usage:", "content": "curl -i -X POST -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n \"https://api-users.sandbox.matic.ninja/api/users/reset\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"id\": \"v@example.com\"\n }\n }'", "type": "curl" } ], "success": { "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 202 Accepted", "type": "json" } ] }, "filename": "src/endpoints/restorePassword.js", "groupTitle": "Users", "error": { "fields": { "Code 404": [ { "group": "Code 404", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 404", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 412": [ { "group": "Code 412", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 412", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 423": [ { "group": "Code 423", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 423", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "UserNotFoundError:", "content": "HTTP/1.1 404 NotFound\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 404,\n\t\t\"title\": \"user test@example.com not found\",\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 412 Precondition Failed\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 412,\n\t\t\"title\": \"user is already active\",\n\t}]\n}", "type": "json" }, { "title": "LockedError:", "content": "HTTP/1.1 423 Locked\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 423,\n\t\t\"title\": \"account has been locked\",\n\t}]\n}", "type": "json" } ] } }, { "type": "post", "url": "/challenge", "title": "Request validation challenge", "version": "1.0.0", "name": "RequestValidation", "group": "Users", "permission": [ { "name": "none" } ], "description": "

Asks server to send an email, containing validation token again

", "parameter": { "fields": { "Body": [ { "group": "Body", "type": "

Object

", "optional": false, "field": "data", "description": "

data container

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

data type

" }, { "group": "Body", "type": "

String

", "optional": false, "field": "data.id", "description": "

username id

" } ] } }, "examples": [ { "title": "Example usage:", "content": "curl -i -X POST -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' -H 'Accept-Encoding: gzip, deflate' \\\n-H 'Content-Type: application/vnd.api+json' \"https://api-users.sandbox.matic.ninja/api/users/challenge\" \\\n-d '{\n \"data\": {\n \"type\": \"user\",\n \"id\": \"v@example.com\"\n }\n}'", "type": "curl" } ], "success": { "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 202 Accepted", "type": "json" } ] }, "filename": "src/endpoints/challenge.js", "groupTitle": "Users", "error": { "fields": { "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ], "Code 404": [ { "group": "Code 404", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 404", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 412": [ { "group": "Code 412", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 412", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 429": [ { "group": "Code 429", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 429", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 429", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" }, { "title": "UserNotFoundError:", "content": "HTTP/1.1 404 NotFound\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 404,\n\t\t\"title\": \"user test@example.com not found\",\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 412 Precondition Failed\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 412,\n\t\t\"title\": \"user is already active\",\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 429 Too Many Requests\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 429,\n\t\t\"title\": \"you have requested to perform this action too many times\",\n\t}]\n}", "type": "json" } ] } }, { "type": "patch", "url": "/reset", "title": "Change password", "version": "1.0.0", "name": "ResetPassword", "group": "Users", "permission": [ { "name": "none|user" } ], "description": "

allows user to change password based on the token, received in the email, or based on the currentPassword and valid JWT token

", "parameter": { "fields": { "Body - when unauthorized": [ { "group": "Body - when unauthorized", "type": "

Object

", "optional": false, "field": "data", "description": "

data container

" }, { "group": "Body - when unauthorized", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

data type

" }, { "group": "Body - when unauthorized", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

data attributes

" }, { "group": "Body - when unauthorized", "type": "

String

", "optional": false, "field": "data.attributes.token", "description": "

reset token from the email

" }, { "group": "Body - when unauthorized", "type": "

String

", "size": "6..50", "optional": false, "field": "data.attributes.password", "description": "

new password

" }, { "group": "Body - when unauthorized", "type": "

String

", "size": "6..50", "optional": false, "field": "data.attributes.passwordRepeat", "description": "

new password confirmation

" } ], "Body - authorized": [ { "group": "Body - authorized", "type": "

Object

", "optional": false, "field": "data", "description": "

data container

" }, { "group": "Body - authorized", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

data type

" }, { "group": "Body - authorized", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

data attributes

" }, { "group": "Body - authorized", "type": "

String

", "size": "6..50", "optional": false, "field": "data.attributes.currentPassword", "description": "

currently used password

" }, { "group": "Body - authorized", "type": "

String

", "size": "6..50", "optional": false, "field": "data.attributes.password", "description": "

new password

" }, { "group": "Body - authorized", "type": "

String

", "size": "6..50", "optional": false, "field": "data.attributes.passwordRepeat", "description": "

new password confirmation

" } ] } }, "examples": [ { "title": "Example usage unauthorized:", "content": "curl -i -X PATCH -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n \"https://api-users.sandbox.matic.ninja/api/users/reset\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"attributes\": {\n \"password\": \"somerealpassword\",\n \"passwordRepeat\": \"somerealpassword\",\n \"token\": \"realresettoken\"\n }\n }\n }'", "type": "curl" }, { "title": "Example usage authorized:", "content": "curl -i -X PATCH -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n -H 'Authroziation: JWT myrealusertoken' \\\n \"https://api-users.sandbox.matic.ninja/api/users/reset\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"attributes\": {\n \"password\": \"somerealpassword\",\n \"passwordRepeat\": \"somerealpassword\",\n \"currentPassword\": \"realcurrentpassword\"\n }\n }\n }'", "type": "curl" } ], "header": { "fields": { "Authorization": [ { "group": "Authorization", "type": "String", "optional": true, "field": "Authorization", "description": "

JWT :accessToken

" } ] }, "examples": [ { "title": "Authorization-Example:", "content": "\"Authorization: JWT myreallyniceandvalidjsonwebtoken\"", "type": "json" } ] }, "success": { "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 204 No Content", "type": "json" } ] }, "filename": "src/endpoints/restorePassword.js", "groupTitle": "Users", "error": { "fields": { "Code 401": [ { "group": "Code 401", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 401", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 404": [ { "group": "Code 404", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 404", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ], "Code 412": [ { "group": "Code 412", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 412", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "UnauthorizedError:", "content": "HTTP/1.1 401 Unauthorized\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 401,\n\t\t\"title\": \"you must authorize to use this endpoint\",\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" }, { "title": "UserNotFoundError:", "content": "HTTP/1.1 404 NotFound\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 404,\n\t\t\"title\": \"user test@example.com not found\",\n\t}]\n}", "type": "json" }, { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 412 Precondition Failed\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 412,\n\t\t\"title\": \"user is already active\",\n\t}]\n}", "type": "json" } ] } }, { "type": "patch", "url": "/:id", "title": "Updates user's data", "version": "1.0.0", "name": "UpdateMetadata", "group": "Users", "permission": [ { "name": "user|admin" } ], "description": "

Updates user's associated data, if user is an admin - he/she can change this data for any of the existing users. However, ordinary user can only change the data for her/himself. For that case :id param my equal me

", "header": { "fields": { "Authorization": [ { "group": "Authorization", "type": "String", "optional": false, "field": "Authorization", "description": "

JWT :accessToken

" } ] }, "examples": [ { "title": "Authorization-Example:", "content": "\"Authorization: JWT myreallyniceandvalidjsonwebtoken\"", "type": "json" } ] }, "parameter": { "fields": { "Params": [ { "group": "Params", "type": "

String

", "optional": false, "field": "id", "description": "

username, for ordinary user must be me. Admin can use any applicable username here

" } ], "Body": [ { "group": "Body", "type": "

Object

", "optional": false, "field": "data", "description": "

data container

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"user\"" ], "optional": false, "field": "data.type", "description": "

data type

" }, { "group": "Body", "type": "

Object

", "optional": false, "field": "data.attributes", "description": "

data attributes container

" }, { "group": "Body", "type": "

String

", "size": "1..150", "optional": false, "field": "data.attributes.firstName", "description": "

user's first name

" }, { "group": "Body", "type": "

String

", "size": "1..150", "optional": false, "field": "data.attributes.lastName", "description": "

user's surname

" }, { "group": "Body", "type": "

String

", "size": "1..150", "optional": false, "field": "data.attributes.companyName", "description": "

user's company name

" }, { "group": "Body", "type": "

String

", "size": "3", "optional": false, "field": "data.attributes.country", "description": "

user's country in ISO3 format, ex: "USA"

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"female\"", "\"male\"", "\"other\"" ], "optional": false, "field": "data.attributes.gender", "description": "

user's gender

" }, { "group": "Body", "type": "

String

", "allowedValues": [ "\"YYYY.MM.DD\"" ], "optional": false, "field": "data.attributes.birthday", "description": "

user's birthday, eg. 1955.10.23

" }, { "group": "Body", "type": "

String

", "size": "6..20", "optional": false, "field": "data.attributes.phone", "description": "

user's phone number

" }, { "group": "Body", "type": "

String[]

", "allowedValues": [ "\"companyName\"", "\"country\"", "\"city\"", "\"gender\"", "\"birthday\"", "\"phone\"" ], "optional": false, "field": "data.remove", "description": "

fields that should be removed from metadata

" } ] } }, "examples": [ { "title": "Example usage (admin):", "content": "curl -i -X PATCH -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n -H 'Authroziation: JWT nicerealtoken' \\\n \"https://api-users.sandbox.matic.ninja/api/users/v%40example.com\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"attributes\": {\n \"firstName\": \"Vitaly\",\n \"lastName\": \"Nordstrom\",\n \"companyName\": \"LasVatos, LLC\",\n \"country\": \"USA\",\n \"city\": \"Las Vegas\",\n \"gender\": \"male\",\n \"birthday\": \"1934.09.25\"\n },\n \"remove\": [ \"phone\" ]\n }\n }'", "type": "curl" }, { "title": "Example usage (user):", "content": "curl -i -X PATCH -H 'Accept-Version: *' -H 'Accept: application/vnd.api+json' \\\n -H 'Accept-Encoding: gzip, deflate' \\\n -H 'Content-Type: application/vnd.api+json' \\\n -H 'Authroziation: JWT nicerealtoken' \\\n \"https://api-users.sandbox.matic.ninja/api/users/me\" \\\n -d '{\n \"data\": {\n \"type\": \"user\",\n \"attributes\": {\n \"companyName\": \"Greenvich\",\n \"country\": \"RUS\"\n },\n \"remove\": [ \"phone\", \"birthday\" ]\n }\n }'", "type": "curl" } ], "success": { "examples": [ { "title": "Success-Response:", "content": "HTTP/1.1 204 No Content", "type": "json" } ] }, "filename": "src/endpoints/update.js", "groupTitle": "Users", "error": { "fields": { "Code 401": [ { "group": "Code 401", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 401", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 401", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 403": [ { "group": "Code 403", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 403", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 403", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 400": [ { "group": "Code 400", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" }, { "group": "Code 400", "type": "

Object[]

", "optional": false, "field": "errors.detail", "description": "

embedded errors that happened

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.text", "description": "

short description of error

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.code", "description": "

error code

" }, { "group": "Code 400", "type": "

String

", "optional": false, "field": "errors.detail.field", "description": "

input field, which was involved

" } ], "Code 404": [ { "group": "Code 404", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 404", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 404", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 412": [ { "group": "Code 412", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 412", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 412", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ], "Code 423": [ { "group": "Code 423", "type": "

Object

", "optional": false, "field": "meta", "description": "

response meta information

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "meta.id", "description": "

request id

" }, { "group": "Code 423", "type": "

Object[]

", "optional": false, "field": "errors", "description": "

array of errors

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.status", "description": "

text code of error

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.title", "description": "

short error description

" }, { "group": "Code 423", "type": "

String

", "optional": false, "field": "errors.code", "description": "

code of error

" } ] }, "examples": [ { "title": "UnauthorizedError:", "content": "HTTP/1.1 401 Unauthorized\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 401,\n\t\t\"title\": \"you must authorize to use this endpoint\",\n\t}]\n}", "type": "json" }, { "title": "ForbiddenResponse:", "content": "HTTP/1.1 403 Forbidden\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 403,\n\t\t\"title\": \"insufficient rights to perform this operation\",\n\t}]\n}", "type": "json" }, { "title": "ValidationError:", "content": "HTTP/1.1 400 BadRequest\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"ValidationError\",\n\t\t\"code\": 400,\n\t\t\"title\": \"short description of the errors\",\n\t\t\"detail\": [{\n\t\t\t\"text\": \"invalid input type\",\n\t\t\t\"code\": 400,\n\t\t\t\"field\": \"data.type\"\n\t\t}]\n\t}]\n}", "type": "json" }, { "title": "UserNotFoundError:", "content": "HTTP/1.1 404 NotFound\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 404,\n\t\t\"title\": \"user test@example.com not found\",\n\t}]\n}", "type": "json" }, { "title": "PreconditionFailedError:", "content": "HTTP/1.1 412 Precondition Failed\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 412,\n\t\t\"title\": \"user is already active\",\n\t}]\n}", "type": "json" }, { "title": "LockedError:", "content": "HTTP/1.1 423 Locked\n{\n\t\"meta\": {\n\t\t\"id\": \"request-id\"\n\t},\n\t\"errors\": [{\n\t\t\"status\": \"HttpStatusError\",\n\t\t\"code\": 423,\n\t\t\"title\": \"account has been locked\",\n\t}]\n}", "type": "json" } ] } } ]