Mayo's API Documentation
api.mayoadeniyi.com
This is the documentation for Mayo's API.
Base URL: https://api.mayoadeniyi.com
General Usage Notes
- All endpoints require an API key for authorisation. See the Mayo's API page for details
- Include the X-Api-Key header with your API key in your requests
- All responses are in JSON format.
- All timestamps are in AEST with the format: yyyy-MM-dd HH:mm:ss
Description of Usual Server Responses
- 200 OK: The request was successful.
- 201 Created: The request was successful and a new resource was created.
- 204 No Content: The request was successful but there is no content to return.
- 400 Bad Request: The request was malformed or missing required parameters.
- 401 Unauthorized: The API key is missing, invalid, or you don't have permission to access the resource.
- 404 Not Found: The requested resource does not exist.
- 500 Internal Server Error: I messed something up.
- 502 Bad Gateway: I messed something up epically.
Authorisation
Obtaining an API key
See the Mayo's API page for details on obtaining an API key.
If you want a key with elevated privelages that doesn't expire, send me an email.
Checking the validity of an API Key
A simple request with your API key, returns the owner's name if the key is valid.
Endpoint: /key-check
Method: GET
Headers:
- X-Api-Key: xxxx-xxxx:xxxxxxxx
Success Response:
Status code: 200 OK
Body:
- owner_name
Playground
Pay Divider
Provide the total pay with the account partitions to divide it accordingly
Endpoint: /playground/pay-divider
Method: POST
Headers:
- Content-Type: application/json
- Accept: application/json
- X-Api-Key: xxxx-xxxx:xxxxxxxx
Body:
{- "totalPay": 5000.00
- "bankAccounts": {
- "Account name 1": 10,
- "Account name 2": 30,
- "Account name 3": 60
- }
}Success Response:
Status code: 200 OK
Body:
{- "partitions": {
- "Account name 1": 500.00,
- "Account name 2": 1500.00,
- "Account name 3": 3000.00
- },
- "calculatedTotal": 5000.00
}Constraints:
- totalPay must be between 1 and 100,000,000
- The number of bankAccounts must be between 2 and 100
- bankAccounts key names must be between 3 and 32 characters
- bankAccounts values must be integers between 0 and 100
- the sum of bankAccounts values must equal 100
File Hasher
Provide a file to recieve its SHA-256 hash digest string
Endpoint: /playground/file-hasher
Method: POST
Headers:
- Content-Type: multipart/form-data; boundary=<auto-generated> (DO NOT SET MANUALLY)
- Accept: application/json
- X-Api-Key: xxxx-xxxx:xxxxxxxx
Body:
{- "file": <binary> (The file within a FormData)
}Success Response:
Status code: 200 OK
Body:
{- "digest": "xxxxxxxx"
}Constraints:
- The maximum file size is 10MB
- The file must have a file name
Image Processor
Provide an image with a desired effect to get the edited image
Endpoint: /playground/image-processor
Method: POST
Headers:
- Content-Type: multipart/form-data; boundary=<auto-generated> (DO NOT SET MANUALLY)
- X-Api-Key: xxxx-xxxx:xxxxxxxx
Body:
{- "effect": "greyscale"
- "file": <binary> (The file within a FormData)
}Success Response:
Status code: 200 OK
Body:
{- <processed image binary>
}Constraints:
- Valid effect values: [ "grayscale", "negative", "sepia", "aberration", "pixelate" ]
- The maximum image size is 10MB
- The image must have a file name
Wiki Search
Provide a search query string to get the top 5 wikipedia search result URLs.
Endpoint: /wiki-search
Method: POST
Headers:
- Content-Type: application/json
- Accept: application/json
- X-Api-Key: xxxx-xxxx:xxxxxxxx
Body:
{- "searchQuery": "Anarchism"
}Success Response:
Status code: 200 OK
Body:
{- "resultsURLs": [
- "https://en.wikipedia.org/wiki?curid=xxxxx,
- "https://en.wikipedia.org/wiki?curid=xxxxx,
- "https://en.wikipedia.org/wiki?curid=xxxxx,
- "https://en.wikipedia.org/wiki?curid=xxxxx,
- "https://en.wikipedia.org/wiki?curid=xxxxx
- ]
}Constraints:
- searchQuery string must be less than 128 characters