Skip to content

Commit

Permalink
UPDATE: complete docs for redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
BaggerFast committed Jun 2, 2024
1 parent e086fb4 commit 4b8c647
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 5 deletions.
3 changes: 1 addition & 2 deletions doc-app/docs/api/admin/domains.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ Shorter domain names greatly enhance the efficiency and brevity of our service.
```

### Errors

- [Not unique](../misc/errors.md#notunique)
- [Not valid](../misc/errors.md#notvalid)
- [Too many records](../misc/errors.md#tomanyrecords)

## GET
Expand Down Expand Up @@ -72,6 +72,5 @@ Get all domains
- Url: `/api/v1/domains/{id}`

### Errors

- [Not found](../misc/errors.md#errors)
- [Is using](../misc/errors.md#isusing)
50 changes: 48 additions & 2 deletions doc-app/docs/api/anonymous/redirects.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ This entity records all user interactions with shortened links, collecting infor
### Base requirements
- Auth: `NO`


## CREATE
- Method: `POST`
- Url: `/api/v1/redirects`
Expand All @@ -31,4 +30,51 @@ This entity records all user interactions with shortened links, collecting infor
- len: `2 < .. < 16`
- regex: `^[a-zA-Z]{2,16}$`
- <u>path</u>
- len: `2 < .. < 16`
- len: `2 < .. < 16`

### Example

```json
{
"os": "windows",
"device": "Mobile",
"ip": "127.0.0.1",
"userKey": "41c6e485-b373-4723-a31e-3ee767367fbd",
"domain": "sh0.su",
"subdomain": "test",
"path": "fcaz6p"
}
```

### Errors
- [Not found](../misc/errors.md#errors)


## GET
- Method: `GET`
- Url: `/api/v1/redirects/link?{domain}=&{path}=&{subdomain}=`

> | name | type | data type | description |
> |-----------|----------|-----------|----------------------------------------|
> | domain | required | string | domain address |
> | subdomain | | string? | subdomain address |
> | path | required | string | url path |
### Validation
- <u>domain</u>
- len: `5 < .. < 32`
- regex: `^[a-z0-9]+[.:][a-z0-9]{2,}$`
- <u>subdomain</u>
- len: `2 < .. < 16`
- regex: `^[a-zA-Z]{2,16}$`
- <u>path</u>
- len: `2 < .. < 16`

### Example

```http
GET {{url}}/api/v1/redirects/link?domain=sh0.su&path=ml6v1s
```

### Errors
- [Not found](../misc/errors.md#errors)
15 changes: 14 additions & 1 deletion doc-app/docs/api/misc/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ The record cannot be deleted because it is referenced by other records.
## NotUnique
The record cannot be created, because not unique
- HttpCode: `409`
- On: `POST`
- On: `POST` `PUT`

### Example
```json
Expand All @@ -49,4 +49,17 @@ The record cannot be created because the maximum count has been reached
"error": "TOO_MANY_RECORDS",
"maxAllowedRecords": 10
}
```

## NotValid
The record is invalid
- HttpCode: `422`
- On: `POST` `PUT`

### Example
```json
{
"error": "BODY_NOT_VALID",
"invalidFields": ["field1", "field2"]
}
```

0 comments on commit 4b8c647

Please sign in to comment.