> For the complete documentation index, see [llms.txt](https://en.help.firstline.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://en.help.firstline.cc/developer/api/request-methods.md).

# Request Method Guide

FIRST LINE uses [RESTful](https://en.wikipedia.org/wiki/Representational_state_transfer) as the main API design, and there are four HTTP request methods used:

| Method     | Description                                                      |
| ---------- | ---------------------------------------------------------------- |
| **GET**    | Request to display a specified resource, i.e. browse data        |
| **POST**   | Used to submit the entity of a specified resource, i.e. add data |
| **PUT**    | Replace the specified resource, i.e. update data                 |
| **DELETE** | Delete the specified resource, i.e. delete data                  |

## Request example

Below is an example of using `POST` a Postman example of requesting to add a customer

```javascript
{
    "membership_no":"R0000555",
    "identity_no":"A000000002",
    "gender":0,
    "first_name":"Chen",
    "last_name":"Dahua",
    "birth_at":"1990-01-01"
}
```

{% hint style="info" %}
In Postman, it is recommended to choose "raw" in Body and enter JSON directly. This can avoid Postman mistakenly converting numbers into strings, thereby preventing errors in some fields during validation.
{% endhint %}

![](https://developers.firstline.cc/images/post_example_1.png)

###

### Headers

![](https://developers.firstline.cc/images/post_example_2.png)

There are three parts to the headers, explained one by one below:

| **Headers**       | Description                                                                                                   |
| ----------------- | ------------------------------------------------------------------------------------------------------------- |
| **Authorization** | That is, the token; a query string parameter can also be used instead.                                        |
| **Content-Type**  | To ensure that both server receiving and returning are handled in JSON format, this header is necessary.      |
| **Accept**        | To ensure that both server-side receiving and returning are handled in JSON format, this header is necessary. |

```javascript
{
    "Authorization":"YOUR_TOKEN",
    "Content-Type": "application/json",
    "Accept":"application/json",
}
```

## Other methods

### GET \ DELETE

`GET`,`DELETE` and so on; just choose the corresponding Postman request method.

### PUT&#x20;

Since direct use of HTTP PUT requests is not supported, when a PUT request is needed, please use the POST method instead and make sure to add the \_method="put" parameter.

![Postman illustration](https://developers.firstline.cc/images/put_example.png)

```javascript
{
    "membership_no":"R0000567",
    "identity_no":"A000000001",
    "gender":0,
    "first_name":"Wang",
    "last_name":"Xiaoming",
    "birth_at":"1999-09-09"
}
```

## Error codes

Uses standard HTTP status codes, defined by [RFC 2616](https://tools.ietf.org/html/rfc2616) and extended by the specifications of [RFC 2518](https://tools.ietf.org/html/rfc2518),[RFC 2817](https://tools.ietf.org/html/rfc2817),[RFC 2295](https://tools.ietf.org/html/rfc2295),[RFC 2774](https://tools.ietf.org/html/rfc2774) and [RFC 4918](https://tools.ietf.org/html/rfc4918) and other specifications. All status codes are divided into five categories; the first digit of the status code represents one of the five response states. The message phrases shown are typical, but any readable alternative may be provided. Unless otherwise noted, the status codes are part of the HTTP/1.1 standard ([RFC 7231](https://tools.ietf.org/html/rfc7231)).

<table data-header-hidden><thead><tr><th width="145">Code</th><th>Description</th></tr></thead><tbody><tr><td>Code</td><td>Description</td></tr><tr><td>400</td><td>Bad Request - Your request is invalid.</td></tr><tr><td>401</td><td>Unauthorized -- Your API key is wrong.</td></tr><tr><td>403</td><td>Forbidden -- The kitten requested is hidden for administrators only.</td></tr><tr><td>404</td><td>Not Found -- The specified kitten could not be found.</td></tr><tr><td>405</td><td>Method Not Allowed -- You tried to access a kitten with an invalid method.</td></tr><tr><td>406</td><td>Not Acceptable -- You requested a format that isn't json.</td></tr><tr><td>410</td><td>Gone -- The kitten requested has been removed from our servers.</td></tr><tr><td>418</td><td>I'm a teapot.</td></tr><tr><td>419</td><td>Sesstion expired.</td></tr><tr><td>422</td><td>Unprocessable Entity.</td></tr><tr><td>429</td><td>Too Many Requests -- You're requesting too many kittens! Slow down!</td></tr><tr><td>500</td><td>Internal Server Error -- We had a problem with our server. Try again later.</td></tr><tr><td>503</td><td>Service Unavailable </td></tr></tbody></table>
