Skip to content

Commit 12cf47e

Browse files
committed
Added Curl Section
1 parent 294d0c0 commit 12cf47e

1 file changed

Lines changed: 47 additions & 0 deletions

File tree

backend/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,53 @@ You can generate client libraries in various programming languages from your Ope
5454
python generate_client.py --list
5555
```
5656

57+
### Curl Examples and Testing
58+
59+
Generate comprehensive curl snippets with response examples:
60+
61+
```sh
62+
# Generate curl examples in markdown and JSON format
63+
python generate_curl_snippets.py
64+
```
65+
66+
This creates:
67+
- `curl_examples.md` - Human-readable examples with responses
68+
- `curl_examples.json` - Machine-readable format
69+
70+
**Test your API with automated curl tests:**
71+
72+
```sh
73+
# Run automated tests against your running API
74+
python test_curl_examples.py
75+
```
76+
77+
**Quick curl examples:**
78+
79+
```bash
80+
# Create a course
81+
curl -X POST "http://localhost:8000/api/v1/items/" \
82+
-H "Content-Type: application/json" \
83+
-d '{
84+
"id": 1,
85+
"name": "Python Programming",
86+
"description": "Learn Python from basics to advanced",
87+
"price": 99.99
88+
}'
89+
90+
# Get all courses
91+
curl -X GET "http://localhost:8000/api/v1/items/" \
92+
-H "Accept: application/json"
93+
94+
# Update a course
95+
curl -X PUT "http://localhost:8000/api/v1/items/1" \
96+
-H "Content-Type: application/json" \
97+
-d '{"price": 129.99}'
98+
99+
# Delete a course
100+
curl -X DELETE "http://localhost:8000/api/v1/items/1" \
101+
-H "Accept: application/json"
102+
```
103+
57104
See [http://localhost:8000/docs](http://localhost:8000/docs) for interactive API documentation (Swagger UI).
58105

59106
## How to Run (Standalone)

0 commit comments

Comments
 (0)