<commit_before># CodrPress REST interface

## Features ##

- Full JSON support for incoming and outgoing data
- [HTTP digest authentication](http://en.wikipedia.org/wiki/Digest_access_authentication)

## Methods

### Get posts

#### Route

`GET /posts/`

Optional GET parameters:

- `limit`: show only # entries (default: 10)
- `offset`: skip # entries (default: 0)

#### Response

```json
{
    {
        "meta": {
            "status": 200,
            "msg": "OK"
        }
    },
    "response": {
        "posts": [
            {
                "_id": "508d90539200ce5810000002",
                "title": "REST-API"
                ...
            }
        ],
        "total": 14,
        "found": 10
    }
}
```

### Get post

#### Route

`GET /post/:id`

`:id` is the 24 characters long hexadecimal MongoId of a post

#### Response

```json
{
    {
        "meta": {
            "status": 200,
            "msg": "OK"
        }
    },
    "response": {
        "posts": [
            {
                "_id": "508d90539200ce5810000002",
                "title": "REST-API"
                ...
            }
        ],
        "total": 1,
        "found": 1
    }
}
```

### Insert post

#### Route

`PUT /post/`

#### Request

```json
{
	"payload": {
		"title": "rest",
		"body": "rest",
		"body_html": null,
		"slugs": ["rest"],
		"status": "published",
		"disqus": false,
		"tags": ["REST"]
	}
}
```

#### Response

```json
{
    {
        "meta": {
            "status": 201,
            "msg": "Created"
        }
    },
    "response": {
        "action": "insert",
        "documentId": "508d90539200ce5810000002",
        "documentUri": "/post/508d90539200ce5810000002/"
    }
}
```

### Update post

#### Route

`POST /post/:id/`

#### Request

```json
{
	"payload": {
		"title": "rest",
		"body": "rest",
		"body_html": null,
		"slugs": ["rest"],
		"status": "published",
		"disqus": false,
		"tags": ["REST"]
	}
}
```

#### Response

```json
{
    {
        "meta": {
            "status": 202,
            "msg": "Accepted"
        }
    },
    "response": {
        "action": "update",
        "documentId": "508d90539200ce5810000002",
        "documentUri": "/post/508d90539200ce5810000002/"
    }
}
```

### Delete post

#### Route

`DELETE /post/:id/`

#### Response

```json
{
    {
        "meta": {
            "status": 202,
            "msg": "Accepted"
        }
    },
    "response": {
        "action": "delete",
        "documentId": "508d90539200ce5810000002"
    }
}
```<commit_msg>damn you, copy & paste ...<commit_after># CodrPress REST interface

## Features ##

- Full JSON support for incoming and outgoing data
- [HTTP digest authentication](http://en.wikipedia.org/wiki/Digest_access_authentication)

## Methods

### Get posts

#### Route

`GET /posts/`

Optional GET parameters:

- `limit`: show only # entries (default: 10)
- `offset`: skip # entries (default: 0)

#### Response

```json
{
    "meta": {
        "status": 200,
        "msg": "OK"
    },
    "response": {
        "posts": [
            {
                "_id": "508d90539200ce5810000002",
                "title": "REST-API"
                ...
            }
        ],
        "total": 14,
        "found": 10
    }
}
```

### Get post

#### Route

`GET /post/:id`

`:id` is the 24 characters long hexadecimal MongoId of a post

#### Response

```json
{
    "meta": {
        "status": 200,
        "msg": "OK"
    },
    "response": {
        "posts": [
            {
                "_id": "508d90539200ce5810000002",
                "title": "REST-API"
                ...
            }
        ],
        "total": 1,
        "found": 1
    }
}
```

### Insert post

#### Route

`PUT /post/`

#### Request

```json
{
	"payload": {
		"title": "rest",
		"body": "rest",
		"body_html": null,
		"slugs": ["rest"],
		"status": "published",
		"disqus": false,
		"tags": ["REST"]
	}
}
```

#### Response

```json
{
    "meta": {
        "status": 201,
        "msg": "Created"
    },
    "response": {
        "action": "insert",
        "documentId": "508d90539200ce5810000002",
        "documentUri": "/post/508d90539200ce5810000002/"
    }
}
```

### Update post

#### Route

`POST /post/:id/`

#### Request

```json
{
	"payload": {
		"title": "rest",
		"body": "rest",
		"body_html": null,
		"slugs": ["rest"],
		"status": "published",
		"disqus": false,
		"tags": ["REST"]
	}
}
```

#### Response

```json
{
    "meta": {
        "status": 202,
        "msg": "Accepted"
    },
    "response": {
        "action": "update",
        "documentId": "508d90539200ce5810000002",
        "documentUri": "/post/508d90539200ce5810000002/"
    }
}
```

### Delete post

#### Route

`DELETE /post/:id/`

#### Response

```json
{
    "meta": {
        "status": 202,
        "msg": "Accepted"
    },
    "response": {
        "action": "delete",
        "documentId": "508d90539200ce5810000002"
    }
}
```
{'fraction_non_alphanumeric': 0.2026889386840497, 'fraction_numerical': 0.07048278671827256, 'mean_word_length': 1.8563118091913904, 'pattern_counts': {'":': 108, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7264437', 'n_tokens_mistral': 2038, 'n_tokens_neox': 1730, 'n_words': 354}