# API Basics To ensure a successful integration, this documentation covers all necessary guidelines, rules, formats, and environment configurations you’ll need. Follow the instructions carefully to develop and go live with Mozrest smoothly. Happy coding! ## Authentication Provide your API key to authenticate all requests. Keep it secret! No password is required. **Important:** - Only HTTPS requests are accepted. - Your API key will be provided by the Mozrest team. ### Example Request ```shell curl "https://api-sandbox.mozrest.com/v1/rms" -H "Authorization: Bearer {api_key}" ``` ## Errors Mozrest uses standard HTTP response codes to indicate request success or failure. ### HTTP Status Code Summary | Code | State | Description | | --- | --- | --- | | 200 | OK | Everything worked as expected | | 400 | Bad request | Missing a required parameter | | 401 | Unauthorized | API key not valid | | 402 | Request Failed | Parameters were valid but request failed | | 403 | Forbidden | Access forbidden | | 404 | Not Found | The requested item does not exist | | 5xx | Server errors | Something went wrong on Mozrest's server | ## Versioning Mozrest releases new API versions when making breaking changes. The current version is **v1**. ## Translations Mozrest supports translations for certain entities. Provide translations in payloads with the translations object. ### Default locale The default locale can be defined at 2 levels: - Globally by Partner - On each Venue ### Providing translation > PAYLOAD EXAMPLE: ```json { "name": "English translation as a default locale", "translations": [ { "locale": "de", "data": [ { "field": "name", "content": "German translation for the field 'name'" } ] }, { "locale": "es", "data": [ { "field": "name", "content": "Spanish translation for the field 'name'" } ] } ] } ``` When providing translation on a creation or update, a translations property must be provided with the following structure: | Key | Type | Description | | --- | --- | --- | | locale | String | Locate to translate in ISO2 format | | data[field] | String | The field to translate.`Example: name, description` | | data[content] | String | The translation in the desired locale | ### Get localized data > EXAMPLE REQUEST: ```shell curl GET "https://api-sandbox.mozrest.com/v1/rms/venues/{venueId}/areas/{areaId}" \ -H "Authorization: Bearer {{api_key}}" \ -H "x-locale: es" ``` In order to get the data localized, **x-locale** the parameter must be provided on the request Headers. The **x-locale** parameter must be provided in ISO2 format. aside If the locale is not indicated on the Header, the data will be returned on the default locale. ## Pagination Mozrest utilizes offset-limit pagination, using the parameter offset and limit. | Key | Constraints | Default | Description | | --- | --- | --- | --- | | offset | 0 to ... | 0 | The first requested element | | limit | 0 to 50 | 10 | The requested number of elements | ## Environments Production: *https://api.mozrest.com/* Sandbox: *https://api-sandbox.mozrest.com/*