#API
API docs coming soon
#Authentication
-
Get your API token via the UI. You can:
- specify activation/expiration dates
- limit access to specific endpoints
- When making a request, send your token in the
token
query param orX-Token
header
#Example
Here is a quick example for accessing the API to delete a site branch.
-
Create an API token
-
Create a
.env
fileAPI_TOKEN=my-token
-
Call the API
// load your .env and place it in process.env require('dotenv/config'); const url = 'https://meli.my-company.com'; const siteId = 'b3a9c55d-d740-436f-84bb-03bdec6bf518'; const axios = require('axios').create({ baseURL: url, headers: { 'X-Token': process.env.API_TOKEN, }, }); async function deleteBranch(name) { const { data } = await axios.get(`/api/v1/sites/${siteId}/branches`); const branch = data.find(branch => branch.name === name); if (!branch) { console.log('Branch not found'); return; } await axios.delete(`/api/v1/sites/${siteId}/branches/${branch._id}`); } deleteBranch('demo').catch(console.error);