> For the complete documentation index, see [llms.txt](https://docs.cremawork.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cremawork.com/v-4-nextjs/decelopment/axios-config/apis-calling.md).

# APIs Calling

Crema has some **predefined hooks and functions to call the APIs** without writing redundant code like sending tokens and other extra configurations in APIs. \
\
These functions are directly linked with your authentication method as well, so you don't need anything special to call APIs without any extra setup.

1. **GET**: to fetch the data from the API. We can use this pre-defined hook&#x20;

```javascript
   const [
    {apiData, loading, initialUrl},
    {setData, setLoading, updateInitialUrl, setQueryParams, reCallAPI},
  ] = useGetDataApi('/dashboard/academy', {data: []}, {page: 1, perPage: 10});
```

2. **POST**: To save data using the API function

```javascript

const infoViewActionsContext = useInfoViewActionsContext(); 
 
postDataApi('/wall/posts', infoViewActionsContext, {
    post,
  })
    .then((data) => {
    // Do anything that you want here
      infoViewActionsContext.showMessage('Post Created Successfully!');
    })
    .catch((error) => {
      infoViewActionsContext.fetchError(error.message);
    });

```

3. **PUT**: To save data using the API function

```javascript
const infoViewActionsContext = useInfoViewActionsContext(); 

putDataApi('/wall/posts/${post.id}', infoViewActionsContext, {
    post,
  })
    .then((data) => {
    // Do anything that you want here
      infoViewActionsContext.showMessage('Post Updated Successfully!');
    })
    .catch((error) => {
      infoViewActionsContext.fetchError(error.message);
    });

```

4. **DELETE:** To Delete entry using the API function

<pre class="language-javascript"><code class="lang-javascript"><strong>
</strong>const infoViewActionsContext = useInfoViewActionsContext(); 
<strong>
</strong><strong>deleteDataApi('/wall/posts/${post.id}', infoViewActionsContext)
</strong>    .then((data) => {
    // Do anything that you want here
      infoViewActionsContext.showMessage('Post Deleted Successfully!');
    })
    .catch((error) => {
      infoViewActionsContext.fetchError(error.message);
    });

</code></pre>
