# Resources

## List all resources

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/resources`

This endpoint allows you to get the list of your resources.\
The resources are returned, sorted by code (A-Z).

#### Query Parameters

| Name      | Type   | Description                                                              |
| --------- | ------ | ------------------------------------------------------------------------ |
| page      | string | The number of page you wish to see. Default is 1.                        |
| per\_page | string | The number of the desired result per page. Default is 20. Maximum is 100 |

#### Headers

| Name                                             | Type   | Description                   |
| ------------------------------------------------ | ------ | ----------------------------- |
| Authentication<mark style="color:red;">\*</mark> | string | Bearer token.                 |
| Accept<mark style="color:red;">\*</mark>         | string | Should be `application/json`. |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "id": 615,
            "user": null,
            "name": "m. st-onge",
            "inactive": 0,
            "language": null,
            "creation": "2020-05-28",
            "birth": null,
            "work_email": null,
            "email": null,
            "phone1": null,
            "phone2": null,
            "cell": null,
            "address": null,
            "city": null,
            "prov": "QC",
            "zip": null
        },
        {
            "id": 614,
            "user": null,
            "name": "m. provencher",
            "inactive": 0,
            "language": null,
            "creation": "2020-05-28",
            "birth": null,
            "work_email": null,
            "email": null,
            "phone1": null,
            "phone2": null,
            "cell": null,
            "address": null,
            "city": null,
            "prov": "QC",
            "zip": null
        }
    ],
    "meta": {
        "current_page": 1,
        "last_page": 1,
        "per_page": 25,
        "total": 2
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}

## Retrieve a resource

<mark style="color:blue;">`GET`</mark> `https://app.gem-books.com/api/resources/:id`

This endpoint allows you to get the details of the resource.

#### Path Parameters

| Name | Type   | Description                        |
| ---- | ------ | ---------------------------------- |
| id   | string | The ID of the resource to retrieve |

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Accept         | string | Should be `application/json`. |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": {
        "id": 615,
        "user": null,
        "name": "m. st-onge",
        "inactive": 0,
        "language": null,
        "creation": "2020-05-28",
        "birth": null,
        "work_email": null,
        "email": null,
        "phone1": null,
        "phone2": null,
        "cell": null,
        "address": null,
        "city": null,
        "prov": "QC",
        "zip": null
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}

## Create a resource

<mark style="color:green;">`POST`</mark> `https://app.gem-books.com/api/resources`

This endpoint allows you to create a resource.\
Returns the created resource.

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Accept         | string | Should be `application/json`. |
| Content-type   | string | Should be `application/json`. |

#### Request Body

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| code | string | Code of resource |
| name | string | Name of resource |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": {
        "id": 615,
        "user": null,
        "name": "m. st-onge",
        "inactive": 0,
        "language": null,
        "creation": "2020-05-28",
        "birth": null,
        "work_email": null,
        "email": null,
        "phone1": null,
        "phone2": null,
        "cell": null,
        "address": null,
        "city": null,
        "prov": "QC",
        "zip": null
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}

## Update a resource

<mark style="color:orange;">`PUT`</mark> `https://app.gem-books.com/api/resources/:id`

This endpoint allows you to update a specific resource.\
Returns the updated resource.

#### Path Parameters

| Name | Type   | Description              |
| ---- | ------ | ------------------------ |
| id   | string | ID of resource to update |

#### Headers

| Name           | Type   | Description                   |
| -------------- | ------ | ----------------------------- |
| Authentication | string | Bearer token.                 |
| Accept         | string | Should be `application/json`. |
| Content-type   | string | Should be `application/json`. |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": {
        "id": 615,
        "user": null,
        "name": "m. st-onge",
        "inactive": 0,
        "language": null,
        "creation": "2020-05-28",
        "birth": null,
        "work_email": null,
        "email": null,
        "phone1": null,
        "phone2": null,
        "cell": null,
        "address": null,
        "city": null,
        "prov": "QC",
        "zip": null
    },
    "success": true
}
```

{% endtab %}
{% endtabs %}


---

# 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://docs.gem-suite.com/api-reference/resources/resources-2.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.
