---
# System prepended metadata

title: Frameblade web services APIs

---

# Frameblade web services APIs

> Version: 0.0.3~alpha

## GET `/api/internal/v1/csrf`

Return CSRF token.

### Examples

Browser:

```
GET /api/internal/v1/csrf
```
```json
{
	"error": true,
	"response": "notFound"
}
```

Internal network:

```
GET /api/internal/v1/csrf HTTP/1.1
Host: web-api.intranet.frameblade.com
Origin: web-edge.intranet.frameblade.com
Key: <Internal preshared Intanet API access key>
```
```json
{
	"error": false,
	"response": "R8ov2YBfTYmzFyjit8o2hKBuoIjXXVpa"
}
```

## GET `/api/v1/news`

Return news IDs.

### Options

| Parameter | Description | Required | Default |
| :-: | :-: | :-: | :-: |
| page | Page number | - | 1 |
| perPage | - | - | 5 | 

### Examples

```
GET /api/v1/news
```
```json
{
	"error": false,
	"response": {
		"articles": [ 1293, 422, 23, 1132, 21 ],
		"articlesCount": 10,
		"page": 1,
		"pages": 2,
		"perPage": 5
	}
}
```

```
GET /api/v1/news?page=2
```
```json
{
	"error": false,
	"response": {
		"articles": [ 134, 4232, 243, 132, 31 ],
		"articlesCount": 10,
		"page": 2,
		"pages": 2,
		"perPage": 5
	}
}
```

## GET `/api/v1/news/latest`

Return latest news IDs.

### Options

| Parameter | Description | Required | Default |
| - | - | :-: | :-: |
| count | Latest news articles count | - | 5 |

### Examples

```
GET /api/v1/news/latest
```
```json
{
	"error": false,
	"response": [ 1293, 422, 23, 1132, 21 ]
}
```

```
GET /api/v1/news/latest?count=2
```
```json
{
	"error": false,
	"response": [ 1293, 422 ]
}
```

## GET `/api/v1/news/:id`

Return news article.

### Options

| Parameter | Description | Required | Default |
| - | - | :-: | :-: |
| excerpt| Include excerpt in response | - | false |

### Examples

```
GET /api/v1/news/21
```
```json
{
	"error": false,
	"response": {
		"id": 21,
		"authors": [ 12 ],
		"editors": [ 12 ],
		"created": 1606463043,
		"updated": 1606463043,
		"body": "# Test article\n\nMarkdown is cool!",
		"tags": [ 124, 21, 4 ]
	}
}
```
```
GET /api/v1/news/21?excerpt=true
```
```json
{
	"error": false,
	"response": {
		"id": 21,
		"authors": [ 12 ],
		"editors": [ 12 ],
		"created": 1606463043,
		"updated": 1606463043,
		"body": "# Test article\n\nMarkdown is cool!",
		"excerpt": "Our first test article.",
		"tags": [ 124, 21, 4 ]
	}
}
```
## GET `/api/v1/news/:id/summary`

Return news article with only excerpt.

### Examples

```
GET /api/v1/news/21/summary
```
```json
{
	"error": false,
	"response": {
		"id": 21,
		"author": 12,
		"created": 1606463043,
		"updated": 1606463043,
		"excerpt": "Our first test article.",
		"tags": [ 124, 21, 4 ]
	}
}
```

## GET `/api/v1/users/:id`

Return user data.

### Options

| Parameter | Description | Required | Default |
| - | - | :-: | :-: |
| page | Page number | - | 1 |

### Examples

```
GET /api/v1/users/12
```
```json
{
	"error": false,
	"response": {
		"id": 12,
		"created": 1606463043,
		"updated": 1606463043,
		"lastOnline": 1606463043,
		// null if privacy is 0
		// 1606463043 if privacy is 1
		"name": "Yaroslav",
		// null if privacy is 0
		// "Yaroslav" if privacy is 1
		"surname": "Vorobev",
		// null if privacy is 0
		// "Vorobev" if privacy is 1
		"nickname": "Zekfad",
		// null if privacy is 0
		// "Zekfad" if privacy is 1
		"dateOfBirth": 1018742400,
		// null if privacy is 0
		// 8899200 if privacy is 1 - this is unix ts with only dd and mm
		// 1018742400 if privacy is 2 - this is full unix ts
		"bio": "Beginning developer",
		// null if privacy is 0
		// "Beginning developer" if privacy is 1
		"roles": [ 0, 1, 2 ],
		"articles": [ 1293, 422, 23, 1132, 21 ],
		// null if privacy is 0
		// [ 1293, 422, 23, 1132, 21 ] if privacy is 1
		"articlesCount": 10,
		// -1 if articles privacy is 0
		// 10 if articles privacy is 1
		"page": 1,
		"pages": 2,
		// 1 if articles privacy is 0
		// 2 if articles privacy is 1
		"perPage": 5,
		"hasAvatar": true,
		"avatar": { // null if no avatar was uploaded or it's deleted
			"100": {
				"url": "cdn1.framebade.com/api/v1/pictures/avatars/12/100",
				"type": "jpg"
			},
			"orig": {
				"url": "cdn3.framebade.com/api/v1/pictures/avatars/12/0",
				"type": "webp"
			}
		},
		"privacy": {
			"lastOnline": 1,
			"name": 1,
			"surname" 1,
			"nickname": 1,
			"dateOfBirth": 2,
			"bio": 1,
			"articles": 1
		}
	}
}
```
## GET `/api/v1/users/:id/summary`

Return user data summary.

### Examples

```
GET /api/v1/users/12/summary
```
```json
{
	"error": false,
	"response": {
		"id": 12,
		"created": 1606463043,
		"updated": 1606463043,
		"lastOnline": 1606463043,
		// null if privacy is 0
		// 1606463043 if privacy is 1
		"name": "Yaroslav",
		// null if privacy is 0
		// "Yaroslav" if privacy is 1
		"surname": "Vorobev",
		// null if privacy is 0
		// "Vorobev" if privacy is 1
		"nickname": "Zekfad",
		// null if privacy is 0
		// "Zekfad" if privacy is 1
		"dateOfBirth": 1018742400,
		// null if privacy is 0
		// 8899200 if privacy is 1
		// 1018742400 if privacy is 2
		"bio": "Beginning developer",
		// null if privacy is 0
		// "Beginning developer" if privacy is 1
		"roles": [ 0, 1, 2 ],
		"articlesCount": 10,
		// -1 if articles privacy is 0
		// 10 if articles privacy is 1
		"hasAvatar": true,
		"avatar": { // null if no avatar was uploaded or it's deleted
			"100": {
				"url": "cdn1.framebade.com/api/v1/pictures/avatars/12/100",
				"type": "jpg"
			},
			"orig": {
				"url": "cdn3.framebade.com/api/v1/pictures/avatars/12/0",
				"type": "webp"
			}
		},
		"privacy": {
			"lastOnline": 1,
			"name": 1,
			"surname" 1,
			"nickname": 1,
			"dateOfBirth": 2,
			"bio": 1,
			"articles": 1
		}
	}
}
```

## GET `/api/v1/tags/:id`

Return tag info.

### Examples

```
GET /api/v1/tags/124
```
```json
{
	"error": false,
	"response": {
		"name": "test tag",
		"description": "Our first (test) tag!"
	}
}
```

## GET `/api/v1/tags/:id/summary`

Return tag data summary.

### Examples

```
GET /api/v1/tags/124/summary
```
```json
{
	"error": false,
	"response": {
		"name": "test tag",
		"description": "Our first (test) tag!",
		"articlesCount": 10
	}
}
```

## GET `/api/v1/status/web-api`

Return tag data summary.

### Examples

```
GET /api/v1/status/web-api
```
```json
{
	"error": false,
	"response": {
		"vg": true, // Indicate that server is opertional
		"uptime": 12130, // Seconds
		"errorsCount": 23, // Server errors (non 4XX)
		"requestsServed": 212 // Requests served with 2XX
	}
}
```

If server is offline Nginx will serve:
```
GET /api/v1/status/web-api
```
```json
{
	"error": true,
	"response": {
		"vg": false,
		"uptime": -1,
		"errorsCount": -1,
		"requestsServed": -1
	}
}
```

