Skip to content

Commit be44c36

Browse files
committed
update use-list and use-latest to match new api change
1 parent c352ab5 commit be44c36

File tree

2 files changed

+550
-73
lines changed

2 files changed

+550
-73
lines changed
Lines changed: 66 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
22
sidebar_position: 2
33
---
4+
import Tabs from "@theme/Tabs";
5+
import TabItem from "@theme/TabItem";
46

57
# Using /latest Endpoint
68

7-
In this tutorial, we will be using the /latest endpoint to get the latest
8-
circular in a category.
9+
In this tutorial, we will be using the `/latest` endpoint to get the latest circular in a category.
910

10-
This endpoint returns a dictionary (for `receive` being `all`) or string (for `receive` being `titles`/`links`), containing the latest circular (of the given category)'s title and direct download URL.
11+
This endpoint returns a JSON object containing the latest circular's information.
1112

1213
:::tip Tip!
1314

@@ -17,62 +18,108 @@ Use the `/cached-latest` endpoint if you're making an app that does not require
1718

1819
#### Parameters:
1920
* `category` : `string`. Can have values (`general`, `ptm`, `exam`) [Mandatory]
20-
* `receive` : `string`. Can have values (`all`, `titles`, `links`) [Optional]
2121

2222
The `category` parameter refers to one of the 3 main category of circulars on the
2323
BPS Website.
2424

25-
The `receive` parameter refers to what data you want to receive, either `all` which gives
26-
the latest circular's Name and download URL, or `titles` which gives only the latest circular's Name, or `links` which gives only the latest circular's download URL.
2725

2826
## Example Requests
2927

30-
Python
3128

3229

30+
<Tabs>
31+
<TabItem value="python" label="Python" default>
32+
33+
Here is an example request using Python's `requests` library:
34+
3335
```python
3436
import requests
3537

36-
url = "https://bpsapi.rajtech.me/v1/latest/"
37-
payload = {'category': 'ptm', "receive": "all"}
38+
url = "https://bpsapi.rajtech.me/v1/latest"
39+
payload = {'category': 'ptm'}
3840

3941
request = requests.get(url, json=payload)
4042
print(request.text)
4143
```
4244

43-
Curl
45+
</TabItem>
46+
<TabItem value="curl" label="cURL">
47+
48+
Here is an example request using cURL:
4449

4550
```bash
4651
curl -X 'GET' \
47-
'https://bpsapi.rajtech.me/v1/latest/' \
52+
'https://bpsapi.rajtech.me/v1/latest' \
4853
-H 'accept: application/json' \
4954
-H 'Content-Type: application/json' \
5055
-d '{
5156
"category": "ptm",
52-
"receive": "all"
5357
}'
5458
```
5559

60+
61+
</TabItem>
62+
63+
</Tabs>
64+
65+
66+
5667
## Example Response
5768

58-
1. Category: `ptm`, Receive: `all`
69+
<Tabs>
70+
<TabItem value="general" label="General" default>
71+
72+
When getting circulars from the `general` category, the response is a dictionary with the following keys:
5973

6074
```python
61-
{"title":"2nd Parent Teacher Meeting (PTM) for Grades IX, X & XII",
62-
"link":"https://bpsdoha.com/circular/category/40-circular-ptm-2022-23?download=1095:2nd-parent-teacher-meeting-ptm-for-grades-ix-x-xii"}
75+
{
76+
"status": "success",
77+
"http_status": 200,
78+
"data": {
79+
"title": "International French Spell Bee",
80+
"link": "https://bpsdoha.com/circular/category/38-circular-ay-2022-23?download=1147"
81+
}
82+
}
6383
```
6484

65-
2. Category: `ptm`, Receive: `titles`
85+
</TabItem>
86+
<TabItem value="ptm" label="PTM">
87+
88+
When getting circulars from the `ptm` category, the response is a dictionary with the following keys:
6689

6790
```python
68-
"2nd Parent Teacher Meeting (PTM) for Grades IX, X & XII"
91+
{
92+
"status": "success",
93+
"http_status": 200,
94+
"data": {
95+
"title": "1st Parent Teacher Meeting (PTM) for Grade XI",
96+
"link": "https://bpsdoha.com/circular/category/40-circular-ptm-2022-23?download=1126"
97+
}
98+
}
6999
```
70100

71-
3. Category: `ptm`, Receive: `links`
101+
102+
</TabItem>
103+
<TabItem value="exam" label="Exam">
104+
105+
When getting circulars from the `exam` category, the response is a dictionary with the following keys:
72106

73107
```python
74-
"https://bpsdoha.com/circular/category/40-circular-ptm-2022-23?download=1095:2nd-parent-teacher-meeting-ptm-for-grades-ix-x-xii"
108+
{
109+
"status": "success",
110+
"http_status": 200,
111+
"data": {
112+
"title": "TIME TABLE - PRE BOARD - 1(X & XII) & HALF YEARLY EXAM (XI) - OCTOBER 2022",
113+
"link": "https://bpsdoha.com/circular/category/35-exam-time-table-and-syllabus-2022-23?download=1146"
114+
}
115+
}
75116
```
117+
118+
119+
</TabItem>
120+
</Tabs>
121+
122+
76123
---
77124

78125
Thanks for reading!

0 commit comments

Comments
 (0)