Skip to content

Commit 64b340c

Browse files
authored
Add POST support to ticket-scan API docs, update params, and clarify examples (#9)
1 parent 8b54929 commit 64b340c

3 files changed

Lines changed: 89 additions & 30 deletions

File tree

src/docs-app/data/api/11-private-api-scan-ticket-by-code.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ Authorization: Token YOUR_API_TOKEN
2323

2424
## Endpoint
2525

26-
The ticket verification endpoint allows you to look up a ticket by its barcode or code:
26+
The ticket verification endpoint allows you to look up a ticket by its barcode or code.
27+
This endpoint supports both GET and POST methods:
2728

2829
```
2930
GET https://www.showpass.com/api/venue/{venue_id}/tickets/items/scan/?code={code}
31+
POST https://www.showpass.com/api/venue/{venue_id}/tickets/items/scan/
3032
```
3133

3234
### Path Parameters
@@ -35,11 +37,15 @@ GET https://www.showpass.com/api/venue/{venue_id}/tickets/items/scan/?code={code
3537
| ---------- | ------- | -------- | --------------------------------------------- |
3638
| `venue_id` | Integer | Required | The ID of your venue |
3739

38-
### Query Parameters
40+
### Query Parameters (GET) / Request Body (POST)
3941

40-
| Parameter | Type | Status | Description |
41-
| --------- | ------ | -------- | ---------------------------------------------- |
42-
| `code` | String | Required | The barcode or code of the ticket to look up |
42+
| Parameter | Type | Status | Description |
43+
| ------------------ | ------ | -------- | --------------------------------------------------------------------------- |
44+
| `code` | String | Required | The barcode or code of the ticket to look up |
45+
| `permittedTypeIDs` | String | Optional | Comma-separated list of ticket type IDs that are allowed to be scanned. If provided, only tickets matching these types will be returned. |
46+
47+
**Note:** When using POST, you need to send the parameters in the request body instead of the query parameters.
48+
This is useful when you want to send a large number of permitted ticket types.
4349

4450
### Response
4551

src/docs-app/data/api/12-private-api-ticket-scan-actions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ The "pickup" action marks a ticket as used, changing its status from "payed" to
3737
### Request Body for Pickup
3838

3939
| Parameter | Type | Status | Description |
40-
| ---------------- | ------- | -------- | ---------------------------------------------------------- |
40+
| ---------------- | ------- |----------| ---------------------------------------------------------- |
4141
| `item` | Integer | Required | The ticket item ID (obtained from verification endpoint) |
4242
| `action` | String | Required | Must be "pickup" for scanning a ticket |
4343
| `scanner_device` | String | Required | The device used for scanning (e.g., "web_app") |
44-
| `barcode_type` | String | Required | The type of barcode (e.g., "static") |
4544
| `barcode_string` | String | Required | The barcode value of the ticket |
45+
| `barcode_type` | String | Optional | The type of barcode (e.g., "static") |
4646

4747
### Notes for Pickup
4848

src/docs-app/data/apiExamplesMap.ts

Lines changed: 76 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -740,61 +740,114 @@ axios.get('https://www.showpass.com/api/public/discovery/', {
740740
* DRF Token auth: -H "Authorization: Token YOUR_API_TOKEN"
741741
*/
742742
const privateApiExamplesMap: Record<string, ApiExamplesData> = {
743-
// ---- Scan a ticket by code (GET) ----
743+
// ---- Scan a ticket by code (GET and POST) ----
744744
"/api/11-private-api-scan-ticket-by-code": {
745-
endpoint: "https://www.showpass.com/api/venue/{venue_id}/tickets/items/scan/?code={code}",
745+
endpoint: "https://www.showpass.com/api/venue/{venue_id}/tickets/items/scan/",
746746
method: "GET",
747-
description: "Lookup a ticket item by barcode/code for scanning.",
747+
description: "Lookup a ticket item by barcode/code for scanning. Supports both GET and POST methods.",
748748
examples: {
749-
curl: `curl -X GET "https://www.showpass.com/api/venue/123456789/tickets/items/scan/?code=test123" \\
750-
-H "Authorization: Token YOUR_API_TOKEN"`,
749+
curl: `# GET method (with query parameters)
750+
curl -X GET "https://www.showpass.com/api/venue/123456789/tickets/items/scan/?code=test123" \\
751+
-H "Authorization: Token YOUR_API_TOKEN"
752+
753+
# GET method
754+
curl -X GET "https://www.showpass.com/api/venue/123456789/tickets/items/scan/?code=test123&permittedTypeIDs=3001,3002" \\
755+
-H "Authorization: Token YOUR_API_TOKEN"
756+
757+
# POST method (with request body)
758+
curl -X POST "https://www.showpass.com/api/venue/123456789/tickets/items/scan/" \\
759+
-H "Authorization: Token YOUR_API_TOKEN" \\
760+
-H "Content-Type: application/json" \\
761+
-d '{
762+
"code": "test123"
763+
}'
764+
765+
# POST method with permittedTypeIDs filter
766+
curl -X POST "https://www.showpass.com/api/venue/123456789/tickets/items/scan/" \\
767+
-H "Authorization: Token YOUR_API_TOKEN" \\
768+
-H "Content-Type: application/json" \\
769+
-d '{
770+
"code": "test123",
771+
"permittedTypeIDs": "3001,3002"
772+
}'`,
751773
python: `import requests
752774
753775
# Define the venue_id and construct the base URL
754776
venue_id = 123456789
755777
base_url = f"https://www.showpass.com/api/venue/{venue_id}/tickets/items/scan/"
756778
757-
# Define the parameters
758-
params = {"code": "test123"}
759-
760779
# Define the headers
761780
headers = {
762781
"Authorization": "Token YOUR_API_TOKEN"
763782
}
764783
765-
# Make the GET request
784+
# Method 1: GET request with query parameters
785+
params = {"code": "test123"}
766786
response = requests.get(base_url, headers=headers, params=params)
787+
print("GET - Status Code:", response.status_code)
788+
print("GET - Response JSON:", response.json())
767789
768-
# Print the response status code and JSON content
769-
print("Status Code:", response.status_code)
770-
print("Response JSON:", response.json())`,
790+
# Method 2: POST request with request body
791+
payload = {"code": "test123"}
792+
headers_post = {
793+
"Authorization": "Token YOUR_API_TOKEN",
794+
"Content-Type": "application/json"
795+
}
796+
response = requests.post(base_url, headers=headers_post, json=payload)
797+
print("POST - Status Code:", response.status_code)
798+
print("POST - Response JSON:", response.json())
799+
800+
# Method 3: POST request with permittedTypeIDs filter
801+
payload_filtered = {"code": "test123", "permittedTypeIDs": "3001,3002"}
802+
response = requests.post(base_url, headers=headers_post, json=payload_filtered)
803+
print("POST (filtered) - Status Code:", response.status_code)
804+
print("POST (filtered) - Response JSON:", response.json())`,
771805
node: `const axios = require('axios');
772806
773807
// Define the venue_id and construct the base URL
774808
const venueId = 123456789;
775809
const baseUrl = \`https://www.showpass.com/api/venue/\${venueId}/tickets/items/scan/\`;
776810
777-
// Define the parameters
778-
const params = {
779-
code: 'test123'
780-
};
781-
782811
// Define the headers
783812
const headers = {
784-
'Authorization': 'Token YOUR_API_TOKEN'
813+
'Authorization': 'Token YOUR_API_TOKEN',
814+
'Content-Type': 'application/json'
815+
};
816+
817+
// --- Example 1: GET Request ---
818+
const getParams = {
819+
code: 'test123'
785820
};
786821
787-
// Make the GET request
788822
axios.get(baseUrl, {
789823
headers: headers,
790-
params: params
824+
params: getParams
791825
})
792826
.then(response => {
793-
console.log('Status Code:', response.status);
794-
console.log('Response Data:', response.data);
827+
console.log('GET Status Code:', response.status);
828+
console.log('GET Response Data:', response.data);
795829
})
796830
.catch(error => {
797-
console.error('Error:', error);
831+
console.error('GET Error:', error);
832+
});
833+
834+
835+
// --- Example 2: POST Request ---
836+
const postData = {
837+
code: 'test123',
838+
// Optional: Add permittedTypeIDs if needed
839+
// permittedTypeIDs: '3001,3002'
840+
};
841+
842+
axios.post(baseUrl, postData, {
843+
headers: headers
844+
})
845+
.then(response => {
846+
console.log('POST Status Code:', response.status);
847+
console.log('POST Response Data:', response.data);
848+
})
849+
.catch(error => {
850+
console.error('POST Error:', error);
798851
});`
799852
},
800853
response: {

0 commit comments

Comments
 (0)