Skip to content

Commit 5715b5b

Browse files
committed
update cachedlatest and getpng docs to match new api changes
1 parent be44c36 commit 5715b5b

File tree

4 files changed

+90
-32
lines changed

4 files changed

+90
-32
lines changed
Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
22
sidebar_position: 5
33
---
4+
import Tabs from "@theme/Tabs";
5+
import TabItem from "@theme/TabItem";
46

57
# Using /cached-latest Endpoint
68

7-
In this tutorial, we will be using the /cached-latest endpoint to get a cached list of
8-
all circulars in one Category.
9+
In this tutorial, we will be using the /cached-latest endpoint to get a cached list of all circulars in a single 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 like the /latest endpoint.
1111
But, This endpoint caches the latest circular for an hour, and returns the cached circulars if the cache is still valid.
1212

1313
This endpoint should be used when making an app that needs to get the latest circulars in one Category but does not need minute level precision.
@@ -20,62 +20,102 @@ Don't use this endpoint if you're making an app that needs minute level precisio
2020

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

25-
The `category` parameter refers to one of the 3 main category of circulars on the
26-
BPS Website.
24+
The `category` parameter refers to one of the 3 main category of circulars on the BPS Website.
2725

28-
The `receive` parameter refers to what data you want to receive, either `all` which gives
29-
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.
3026

3127
## Example Requests
3228

33-
Python
29+
<Tabs>
30+
<TabItem value="python" label="Python" default>
3431

32+
Here is an example request using Python's `requests` library:
3533

3634
```python
3735
import requests
3836

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

4240
request = requests.get(url, json=payload)
4341
print(request.text)
4442
```
4543

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

4849
```bash
4950
curl -X 'GET' \
50-
'https://bpsapi.rajtech.me/v1/cached-latest/' \
51+
'https://bpsapi.rajtech.me/v1/cached-latest' \
5152
-H 'accept: application/json' \
5253
-H 'Content-Type: application/json' \
5354
-d '{
5455
"category": "ptm",
55-
"receive": "all"
5656
}'
5757
```
5858

59+
60+
</TabItem>
61+
</Tabs>
62+
5963
## Example Response
6064

61-
1. Category: `ptm`, Receive: `all`
65+
<Tabs>
66+
<TabItem value="general" label="General" default>
67+
68+
When getting circulars from the `general` category, the response is a dictionary with the following keys:
6269

6370
```python
64-
{"title":"2nd Parent Teacher Meeting (PTM) for Grades IX, X & XII",
65-
"link":"https://bpsdoha.com/circular/category/40-circular-ptm-2022-23?download=1095:2nd-parent-teacher-meeting-ptm-for-grades-ix-x-xii"}
71+
{
72+
"status": "success",
73+
"http_status": 200,
74+
"data": {
75+
"title": "International French Spell Bee",
76+
"link": "https://bpsdoha.com/circular/category/38-circular-ay-2022-23?download=1147"
77+
}
78+
}
6679
```
6780

68-
2. Category: `ptm`, Receive: `titles`
81+
</TabItem>
82+
<TabItem value="ptm" label="PTM">
83+
84+
When getting circulars from the `ptm` category, the response is a dictionary with the following keys:
6985

7086
```python
71-
"2nd Parent Teacher Meeting (PTM) for Grades IX, X & XII"
87+
{
88+
"status": "success",
89+
"http_status": 200,
90+
"data": {
91+
"title": "1st Parent Teacher Meeting (PTM) for Grade XI",
92+
"link": "https://bpsdoha.com/circular/category/40-circular-ptm-2022-23?download=1126"
93+
}
94+
}
7295
```
7396

74-
3. Category: `ptm`, Receive: `links`
97+
98+
</TabItem>
99+
<TabItem value="exam" label="Exam">
100+
101+
When getting circulars from the `exam` category, the response is a dictionary with the following keys:
75102

76103
```python
77-
"https://bpsdoha.com/circular/category/40-circular-ptm-2022-23?download=1095:2nd-parent-teacher-meeting-ptm-for-grades-ix-x-xii"
104+
{
105+
"status": "success",
106+
"http_status": 200,
107+
"data": {
108+
"title": "TIME TABLE - PRE BOARD - 1(X & XII) & HALF YEARLY EXAM (XI) - OCTOBER 2022",
109+
"link": "https://bpsdoha.com/circular/category/35-exam-time-table-and-syllabus-2022-23?download=1146"
110+
}
111+
}
78112
```
113+
114+
115+
</TabItem>
116+
</Tabs>
117+
118+
79119
---
80120

81121
Thanks for reading!
Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,69 @@
11
---
22
sidebar_position: 4
33
---
4+
import Tabs from "@theme/Tabs";
5+
import TabItem from "@theme/TabItem";
6+
47
# Using /getpng Endpoint
58

69
In this tutorial, we will be using the `/getpng` endpoint to get a circular's PNG file.
7-
The `/search` endpoint returns a string containing the direct URL to the PNG file.
10+
11+
The `/getpng` endpoint returns a string containing the direct URL to a PNG version of a BPS Circular.
812

913

1014
#### Parameters:
1115

12-
* `url` : `string`. The PDF's URL [Mandatory]
16+
* `url` : `string`. A valid URL pointing to a .pdf file on the BPS website [Mandatory]
1317

1418
The `url` parameter refers to the direct circular PDF download URL.
1519

1620

1721
## Example Requests
1822

19-
Python
23+
<Tabs>
24+
<TabItem value="python" label="Python" default>
25+
26+
Here is an example request using Python's `requests` library:
2027

2128
```python
2229
import requests
2330

24-
url = "https://bpsapi.rajtech.me/v1/getpng/"
31+
url = "https://bpsapi.rajtech.me/v1/getpng"
2532
payload = {"url": "https://bpsdoha.net/circular/category/38-circular-ay-2022-23?download=1123"}
2633

2734
request = requests.get(url, json=payload)
2835
print(request.text)
2936
```
3037

31-
Curl
38+
</TabItem>
39+
<TabItem value="curl" label="cURL">
40+
41+
Here is an example request using cURL:
3242

3343
```bash
3444
curl -X 'GET' \
35-
'https://bpsapi.rajtech.me/v1/getpng/' \
45+
'https://bpsapi.rajtech.me/v1/getpng' \
3646
-H 'accept: application/json' \
3747
-H 'Content-Type: application/json' \
38-
-d '{"url": "https://bpsdoha.net/circular/category/38-circular-ay-2022-23?download=1123"}'
48+
-d '{
49+
"url": "https://bpsdoha.net/circular/category/38-circular-ay-2022-23?download=1123"
50+
}'
3951
```
4052

41-
## Example Responses
4253

54+
</TabItem>
55+
</Tabs>
56+
57+
## Example Responses
4358

4459
```python
45-
"https://bpsapi.rajtech.me/circularpng/1123.png"
60+
{
61+
"status": "success",
62+
"http_status": 200,
63+
"data": "https://bpsapi.rajtech.me/circularpng/1123.png"
64+
}
4665
```
66+
4767
---
4868

4969
Thanks for reading!

docs/API/using-the-api/Use-latest.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ curl -X 'GET' \
5959

6060

6161
</TabItem>
62-
6362
</Tabs>
6463

6564

docs/API/using-the-api/Use-list.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ curl -X 'GET' \
5252

5353

5454
</TabItem>
55-
5655
</Tabs>
5756

5857

0 commit comments

Comments
 (0)