# Firearm Endpoints

{% hint style="danger" %}
The API has been deprecated and is no longer in use.
{% endhint %}

### Firearm Endpoints

Raw list of firearm endpoints:

* GET /firearm/info
* GET /firearm/list
* POST /firearm/create
* PATCH /firearm/edit
* DELETE /firearm/delete

List of firearm endpoint methods

{% tabs %}
{% tab title="Firearm Array Structure" %}
If you see the empty "firearm" array or `firearm: []`  This is simply just the placeholder for the firearm object structure, Which looks like this in all major requests: (Inside the array)

```javascript
{            
   id: "ID",
   userID: "USER_ID",
   userName: "USER_NAME",
   civilianID: "CIV_ID",
   civilianName: "CIV_NAME",
   stolen: "STOLEN",
   serialNumber: "SERIAL_NUMBER",
   model: "MODEL",
   timestamp: "TIMESTAMP"
}
```

{% endtab %}
{% endtabs %}

## Firearm Information (Search)

<mark style="color:blue;">`GET`</mark> `https://roleplaybot.xyz/api/firearm/info`

Searches for a registered firearm, Returns information if it exists.

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                           | Type           | Description                           |
| ---------------------------------------------- | -------------- | ------------------------------------- |
| serialNumber<mark style="color:red;">\*</mark> | SERIAL\_NUMBER | Firearm Serial Number (String) (# ID) |

{% tabs %}
{% tab title="200: OK Firearm Found" %}
Firearm found and information displayed

```javascript
{
    found: true,
    guildID: "GUILD_ID",
    firearm: []
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}
Invalid or missing field

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="404: Not Found Firearm not found" %}

```javascript
{
    found: false,
    error: "404 Not found",
    details: "Firearm not found (10023)"
}
```

{% endtab %}
{% endtabs %}

## List Firearms

<mark style="color:blue;">`GET`</mark> `https://roleplaybot.xyz/api/firearm/list`

Provides every registered vehicle inside the guild

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

{% tabs %}
{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="200: OK Firearms Found" %}
One or more firearms found and listed

```javascript
{
    amount: "FIREARM_AMOUNT",
    guildID: "GUILD_ID",
    firearms: []
}
```

{% endtab %}

{% tab title="404: Not Found No Firearms Found" %}
There is no registered firearms inside the guild

```javascript
{
    error: "404 Not found",
    details: "Unable to find any firearms (20060)"
}
```

{% endtab %}
{% endtabs %}

## Create Firearm

<mark style="color:green;">`POST`</mark> `https://roleplaybot.xyz/api/firearm/create`

Registers a firearm to a civilian character

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                    | Type      | Description            |
| --------------------------------------- | --------- | ---------------------- |
| name<mark style="color:red;">\*</mark>  | CIV\_NAME | Civilian Name (String) |
| model<mark style="color:red;">\*</mark> | MODEL     | Firearm Model (String) |
| color<mark style="color:red;">\*</mark> | COLOR     | Firearm Color (String) |

{% tabs %}
{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}
Invalid or missing field

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="201: Created Registered Firearm" %}
Registered vehicle

```javascript
{
    guildID: "GUILD_ID",
    civilianID: "CIV_ID",
    civilianName: "CIV_NAME",
    userName: "USER_NAME",
    userID: "USER_ID"
    success: "Registered firearm",
    firearm: []
}
```

{% endtab %}

{% tab title="500: Internal Server Error Unable to register firearm" %}
Database error, Unable to register firearm inside database. Contact RoleplayBot support

```javascript
{
    error: "500 Internal server error",
    details: "Unable to execute request (10022)"
}
```

{% endtab %}
{% endtabs %}

## Edit Firearm

<mark style="color:purple;">`PATCH`</mark> `https://roleplaybot.xyz/api/firearm/edit`

Edits a firearm with the specified field and value\
Valid Fields:\
\- color (Value: String)\
\- stole (Value: Boolean)

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                    | Type      | Description                                    |
| --------------------------------------- | --------- | ---------------------------------------------- |
| name<mark style="color:red;">\*</mark>  | CIV\_NAME | Civilian Name (String)                         |
| field<mark style="color:red;">\*</mark> | FIELD     | Field to edit (Must be listed in valid fields) |
| value<mark style="color:red;">\*</mark> | VALUE     | Value to set (Must match allocated field)      |

{% tabs %}
{% tab title="403: Forbidden Forbidden Guild Access" %}
Accessing a guild that is not authorized apart of your API key

```javascript
{
    "error": "403 Forbidden",
    "details": "Unauthorised guild access (20058)"
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="201: Created Firearm Edited" %}
Firearm successfully edited

```javascript
{
    guildID: "GUILD_ID",
    serialNumber: "SERIAL_NUMBER",
    civilianName: "CIV_NAME",
    civilianID: "CIV_ID",
    userID: "USER_ID",
    userName: "USER_NAME",
    plate: "PLATE",
    success: "Updated firearm to <...>",
    firearm: []
}
```

{% endtab %}

{% tab title="500: Internal Server Error Unable to edit firearm" %}
Database error, Unable to edit firearm inside database. Contact RoleplayBot support

```javascript
{
    error: "500 Internal server error",
    details: "Unable to execute request (10021)"
}
```

{% endtab %}
{% endtabs %}

## Delete Vehicle

<mark style="color:red;">`DELETE`</mark> `https://roleplaybot.xyz/api/firearm/delete`

Deletes a firearm using the serial number

#### Headers

| Name                                            | Type      | Description           |
| ----------------------------------------------- | --------- | --------------------- |
| Authorization<mark style="color:red;">\*</mark> | API\_KEY  | API Authorization Key |
| Guild<mark style="color:red;">\*</mark>         | GUILD\_ID | Discord Guild ID      |

#### Request Body

| Name                                           | Type           | Description                           |
| ---------------------------------------------- | -------------- | ------------------------------------- |
| serialNumber<mark style="color:red;">\*</mark> | SERIAL\_NUMBER | Firearm Serial Number (String) (# ID) |

{% tabs %}
{% tab title="200: OK Firearm Deleted" %}
Successfully deleted firearm

```javascript
{
    guildID: "GUILD_ID",
    id: "VEHICLE_ID",
    success: 'Deleted registered firearm'
}
```

{% endtab %}

{% tab title="400: Bad Request One or more fields are invalid" %}

```javascript
{
    "error": "400 Bad request",
    "details": "Invalid <FIELD> provided (<ERR-CODE>)"
}
```

{% endtab %}

{% tab title="500: Internal Server Error Unable to delete firearm" %}
Database error, Unable to delete firearm inside database. Contact RoleplayBot support

```javascript
{
    error: "500 Internal server error",
    details: "Unable to execute request (10021)"
}
```

{% 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.roleplaybot.xyz/api/endpoints/firearm.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.
