Skip to content

Commit f34849f

Browse files
authored
Merge pull request #179 from Real-Dev-Squad/api-contract/logs
api-contract/logs: update API contract for /logs
2 parents 25adc3f + 31a8273 commit f34849f

File tree

2 files changed

+59
-6
lines changed

2 files changed

+59
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
- [Users](/users)
1616
- [Badges](/badges)
1717
- [CloudflareCache](/cloudflare-cache)
18+
- [Logs](/logs)

logs/README.md

Lines changed: 58 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@
1515

1616
| Route | Description |
1717
| :--------------------------: | :-----------------------: |
18-
| [GET /logs/:type](#get-logs) | Returns logs of all types |
18+
| [GET /logs/:type](#get-logstype) | Returns logs of the specific types |
19+
| [GET /logs](#get-logs) | Returns all the logs |
1920

2021
---
21-
22-
## **GET /logs/:type**
23-
2422
**Note :**
2523

26-
- This API can only be accessed by super user
24+
- These API can only be accessed by super user
25+
26+
## **GET /logs/:type**
2727

2828
Returns all logs according to the provided queries and path/named-route param.
2929

@@ -40,7 +40,7 @@ Returns all logs according to the provided queries and path/named-route param.
4040
- **Query**
4141

4242
- Optional: `userId=[string]` for type = `archive-details`
43-
43+
4444
- **Headers**
4545
None
4646
- **Cookie**
@@ -85,3 +85,55 @@ Returns all logs according to the provided queries and path/named-route param.
8585
"message": "Something went wrong. Please contact admin"
8686
}
8787
```
88+
## **GET /logs**
89+
90+
Returns all the logs present in the collection.
91+
92+
**Query**
93+
94+
`dev=[boolean]`
95+
96+
Optional: `type=`
97+
- `CLOUDFLARE_CACHE_PURGED`
98+
- `PROFILE_DIFF_APPROVED`
99+
- `PROFILE_DIFF_REJECTED`
100+
- `extensionRequests`
101+
- `task`
102+
- `task-requests`
103+
- `REQUEST_CREATED`
104+
- `REQUEST_APPROVED`
105+
- `REQUEST_REJECTED`
106+
107+
- Optional: `format=feed` (returns all the logs in flattend or formatted way)
108+
- Optional: `page=[integer]` (page can either be 0 or a positive integer. Default value is 0)
109+
- Optional: `size=[integer]` (size is the number of logs requested per page. Default value is 5)
110+
- Optional: `next=[string]` (next is the id of the document to get next set of documents of results from that document)
111+
- Optional: `prev=[string]` (prev is the id of the document to get prev set of documents of results before that document)
112+
113+
- **Body**
114+
None
115+
- **Headers**
116+
None
117+
118+
- **Cookie**
119+
rds-session: <JWT SUPERUSER>
120+
121+
- **Success Response:**
122+
123+
- **Code:** 200
124+
- **Content:**
125+
```json
126+
{
127+
"message": "All Logs fetched successfully",
128+
"data": ["<LOG_OBJECT>", "<LOG_OBJECT>...."],
129+
"next": "/logs?dev=true&size=5&next=<document-id>",
130+
"prev": null
131+
}
132+
```
133+
- **Error Response:**
134+
- **Code:** 401
135+
- **Content:** `{ 'statusCode': 401, 'error': 'Unauthorized', 'message': 'Unauthenticated User' }`
136+
- **Code:** 204
137+
- **Content:** `{ 'statusCode': 204, 'error': 'Not Found', 'message': 'Logs not found' }`
138+
- **Code:** 500
139+
- **Content:** `{ 'statusCode': 500, 'error': 'Internal Server Error', 'message': 'An internal server error occurred' }`

0 commit comments

Comments
 (0)