> For the complete documentation index, see [llms.txt](https://skygl.gitbook.io/devlog/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skygl.gitbook.io/devlog/blogreq.md).

# BlogReq

## Create Blog Request

<mark style="color:green;">`POST`</mark> `https://api.devlog.today/blogreqs`

This endpoint allows you to create new blog request.

#### Headers

| Name          | Type   | Description                        |
| ------------- | ------ | ---------------------------------- |
| authorization | string | Json Web Token certified as admin. |

#### Request Body

| Name | Type   | Description                          |
| ---- | ------ | ------------------------------------ |
| url  | string | URL of blog request will be created. |

{% tabs %}
{% tab title="200 Response if Blog request created successfully." %}

```javascript
{
    "_id": "5f1949fdf8504628489bef38",
    "url": "https://devlog.todays",
    "status": "Unhandled",
    "created_at": "2020-07-23T08:27:41.961Z",
    "updated_at": "2020-07-23T08:27:41.961Z",
    "__v": 0,
    "id": "5f1949fdf8504628489bef38"
}
```

{% endtab %}

{% tab title="409 Response if Blog or Blog request with given URL exists already." %}

```javascript
// A blog with the URL was registered before.
{
    "type": "blog"
}

// A blog request with the URL was registered before.
{
    "type": "blogreq"
}
```

{% endtab %}

{% tab title="422 Given parameters were not valid URL format" %}

```javascript
{
    "errors": [
        {
            "value": "abcd",
            "msg": "must be url",
            "param": "feed.url",
            "location": "body"
        }
    ]
}
```

{% endtab %}

{% tab title="500 Response if unexpected server error or database error occurs" %}

```
```

{% endtab %}
{% endtabs %}

## Get List of Blog Requests

<mark style="color:blue;">`GET`</mark> `https://api.devlog.today/blogreqs`

This endpoint allows you to get blog requests that meet the corresponding condition.

#### Query Parameters

| Name    | Type    | Description                                                                |
| ------- | ------- | -------------------------------------------------------------------------- |
| \_start | integer | Starting index of blog requests.                                           |
| \_end   | integer | Ending index of blog request. (must be positive and bigger than "\_start") |
| \_sort  | string  | Field name which blog requests will be sorted by.                          |
| \_order | string  | Sort order. (ASC or DESC)                                                  |
| url     | string  | Words included in URL                                                      |

#### Headers

| Name          | Type   | Description                        |
| ------------- | ------ | ---------------------------------- |
| authorization | string | Json Web Token certified as admin. |

{% tabs %}
{% tab title="200 Response if a server find blog requests successfully." %}

```javascript
[
    {
        "_id": "5f0489be926c4496a4e7babc",
        "created_at": "2020-07-07T14:42:06.189Z",
        "updated_at": "2020-07-07T14:42:15.171Z",
        "url": "https://devlog.today",
        "status": "Unhandled",
        "__v": 0,
        "reason": null,
        "id": "5f0489be926c4496a4e7babc"
    },
    
    // ... more Blog Requests
]
```

{% endtab %}

{% tab title="422 Response if query parameters are not valid format." %}

```javascript
{
    "errors": [
        {
            "value": "0",
            "msg": "must be less than end",
            "param": "_start",
            "location": "query"
        }
    ]
}
```

{% endtab %}

{% tab title="500 Response if unexpected server error or database error occurs." %}

```
```

{% endtab %}
{% endtabs %}

## Get A Blog Request with Id

<mark style="color:blue;">`GET`</mark> `https://api.devlog.today/blogreqs/:id`

This endpoint allows you to get a blog request with id.

#### Query Parameters

| Name | Type   | Description                          |
| ---- | ------ | ------------------------------------ |
| id   | string | ObjectId of blog request to be found |

#### Headers

| Name          | Type   | Description                        |
| ------------- | ------ | ---------------------------------- |
| authorization | string | Json Web Token certified as admin. |

{% tabs %}
{% tab title="200 Response if blog request with the corresponding id exists." %}

```javascript
{
    "_id": "5f1949fdf8504628489bef38",
    "url": "https://devlog.todays",
    "status": "Unhandled",
    "created_at": "2020-07-23T08:27:41.961Z",
    "updated_at": "2020-07-23T08:27:41.961Z",
    "__v": 0,
    "id": "5f1949fdf8504628489bef38"
}
```

{% endtab %}

{% tab title="404 Response if blog request with the corresponding id doesn't exist." %}

```
```

{% endtab %}

{% tab title="422 Given parameter is not valid format." %}

```javascript
{
    "errors": [
        {
            "value": "5e95be06b3e7301d1f99ec4",
            "msg": "must be mongoId",
            "param": "id",
            "location": "params"
        }
    ]
}
```

{% endtab %}

{% tab title="500 Response if unexpected server error or database error occurs." %}

```
```

{% endtab %}
{% endtabs %}

## Update Blog Request

<mark style="color:orange;">`PUT`</mark> `https://api.devlog.today/blogreqs/:id`

This endpoint allows you to update a blog request.

#### Path Parameters

| Name | Type   | Description                               |
| ---- | ------ | ----------------------------------------- |
| id   | string | ObjectId of a blog request to be updated. |

#### Headers

| Name          | Type   | Description                        |
| ------------- | ------ | ---------------------------------- |
| authorization | string | Json Web Token certified as admin. |

#### Request Body

| Name     | Type   | Description                                                                     |
| -------- | ------ | ------------------------------------------------------------------------------- |
| url      | string | URL of blog request to be updated                                               |
| status   | string | Status of blog request to be updated (Unhandled, Denied, Suspended, Registered) |
| reason   | string | Reason of changing status                                                       |
| feed.url | string | if status is "Registered", feed URL of blog will be registered                  |
| feed.tag | string | if status if "Registered", tag selector of blog will be registered.             |

{% tabs %}
{% tab title="200 Response if Blog request updated successfully." %}

```javascript
{
    "id": "5e95be06b3e7301d1f99eabc",
    "previousData": {
        "_id": "5e95be06b3e7301d1f99eabc",
        "updated_at": "2020-07-07T06:54:02.695Z",
        "url": "https://devlog.today",
        "status": "Unhandled",
        "created_at": "2020-07-06T13:43:34.202Z",
    },
    "data": {
        "_id": "5e95be06b3e7301d1f99eabc",
        "updated_at": "2020-07-07T06:54:02.695Z",
        "url": "https://devlog.today",
        "status": "Registered",
        "created_at": "2020-07-06T13:43:34.202Z",
    }
}
```

{% endtab %}

{% tab title="404 Response if Blog request with given Id doesn't exist." %}

```
```

{% endtab %}

{% tab title="409 Response if Blog with given URL was registered before." %}

```
```

{% endtab %}

{% tab title="422 Given parameters were not valid format." %}

```
{
    "errors": [
        {
            "value": "abc",
            "msg": "must be url",
            "param": "feed.url",
            "location": "body"
        }
    ]
}
```

{% endtab %}

{% tab title="500 Response if unexpected server error or database error occurs." %}

```
```

{% endtab %}
{% endtabs %}

## Delete Blog Request

<mark style="color:red;">`DELETE`</mark> `https://api.devlog.today/blogreqs/:id`

#### Path Parameters

| Name | Type   | Description                            |
| ---- | ------ | -------------------------------------- |
| id   | string | ObjectId of blog request to be deleted |

#### Headers

| Name          | Type   | Description                        |
| ------------- | ------ | ---------------------------------- |
| authorization | string | Json Web Token certified as admin. |

{% tabs %}
{% tab title="200 Response if blog request with given Id deleted successfully." %}

```javascript
{
    "_id": "5f1949fdf8504628489bef38",
    "url": "https://devlog.todays",
    "status": "Unhandled",
    "created_at": "2020-07-23T08:27:41.961Z",
    "updated_at": "2020-07-23T08:27:41.961Z",
    "__v": 0
}
```

{% endtab %}

{% tab title="404 Response if blog with given Id doesn't exist." %}

```
```

{% endtab %}

{% tab title="422 Given parameters were not valid format." %}

```javascript
{
    "errors": [
        {
            "value": "abcd",
            "msg": "must be mongoId",
            "param": "id",
            "location": "params"
        }
    ]
}
```

{% endtab %}

{% tab title="500 Unexpected server error or database error." %}

```
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://skygl.gitbook.io/devlog/blogreq.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
