# Axios

Using the Axios library ([JSFiddle](https://jsfiddle.net/mirko77/4eymak75/1/))

```

// Example of getting entries using Axios

// Replace parameters with your own credentials
const params = {
  grant_type: 'client_credentials',
  client_id: 4879,
  client_secret: 'XbIHCZHh5WQhJCaLduHSAzzddFFI6PkHA78XUZeE'
};

// Replace with your project slug
const projectSlug = "ec5-api-private";

// Perform Axios request to get token
axios.post('https://five.epicollect.net/api/oauth/token', params, {
  headers: {
    'Content-Type': 'application/vnd.api+json'
  }
})
.then(response => {
  console.log(JSON.stringify(response.data));
  // The token is valid for 2 hours, let's get the entries
  _getEntries(response.data.access_token);
})
.catch(error => {
  console.error(error.response.data);
});

// Get the entries, passing token for authorization
function _getEntries(token) {
  axios.get(`https://five.epicollect.net/api/export/entries/${projectSlug}`, {
    headers: {
      'Content-Type': 'application/vnd.api+json',
      'Authorization': `Bearer ${token}`
    }
  })
  .then(response => {
    console.log(JSON.stringify(response.data, null, 2));
    document.querySelector('.content').textContent = JSON.stringify(response.data, null, 2);
  })
  .catch(error => {
    console.error(error.response.data);
    document.querySelector('.content').textContent = JSON.stringify(error.response.data, null, 2);
  });
}

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.epicollect.net/api-authentication/access-resources/axios.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
