Skip to content

Commit da63e48

Browse files
Copilotxavierjohn
andcommitted
Add .http files for all API examples
Co-authored-by: xavierjohn <[email protected]>
1 parent 8a42bd7 commit da63e48

File tree

20 files changed

+1339
-0
lines changed

20 files changed

+1339
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
###
2+
# AdvancedODataWebApiExample - ASP.NET OData Web API Advanced Versioning
3+
# This example demonstrates advanced OData scenarios with multiple versioning strategies for legacy ASP.NET Web API
4+
###
5+
6+
@baseUrl = http://localhost:52667
7+
8+
### People - Get All (Default Version)
9+
# Get all people (defaults to latest version when AssumeDefaultVersionWhenUnspecified is enabled)
10+
GET {{baseUrl}}/api/people
11+
12+
### People - Get All - Version 1.0
13+
# Get all people using OData query
14+
GET {{baseUrl}}/api/people?api-version=1.0
15+
16+
### People - Get All with $select - Version 1.0
17+
# Get all people with specific fields
18+
GET {{baseUrl}}/api/people?api-version=1.0&$select=FirstName,LastName
19+
20+
### People - Get All with $filter - Version 1.0
21+
# Get filtered people
22+
GET {{baseUrl}}/api/people?api-version=1.0&$filter=Id eq 1
23+
24+
### People - Get by Key - Version 1.0
25+
# Get a specific person by ID
26+
GET {{baseUrl}}/api/people/1?api-version=1.0
27+
28+
### People - Get All - Version 2.0
29+
# Get all people using OData query
30+
GET {{baseUrl}}/api/people?api-version=2.0
31+
32+
### People - Get All with $select - Version 2.0
33+
# Get all people with specific fields
34+
GET {{baseUrl}}/api/people?api-version=2.0&$select=FirstName,LastName,Email
35+
36+
### People - Get by Key - Version 2.0
37+
# Get a specific person by ID
38+
GET {{baseUrl}}/api/people/1?api-version=2.0
39+
40+
### People - Patch - Version 2.0
41+
# Update a person using OData PATCH
42+
PATCH {{baseUrl}}/api/people/1?api-version=2.0
43+
Content-Type: application/json
44+
45+
{
46+
"firstName": "Jane",
47+
"email": "[email protected]"
48+
}
49+
50+
### People (V2) - Get All - Version 2.0
51+
# Get all people from version 2 specific controller
52+
GET {{baseUrl}}/api/people2?api-version=2.0
53+
54+
### People (V2) - Get by Key - Version 2.0
55+
# Get a specific person by ID from version 2 controller
56+
GET {{baseUrl}}/api/people2/1?api-version=2.0
57+
58+
### Orders - Get All - Version 1.0
59+
# Get all orders
60+
GET {{baseUrl}}/api/v1/orders
61+
62+
### Orders - Get All with $select - Version 1.0
63+
# Get orders with specific fields
64+
GET {{baseUrl}}/api/v1/orders?$select=Id,Customer
65+
66+
### Orders - Get by Key - Version 1.0
67+
# Get a specific order by ID
68+
GET {{baseUrl}}/api/v1/orders/1
69+
70+
### Orders - Get All - Version 2.0
71+
# Get all orders for version 2.0
72+
GET {{baseUrl}}/api/v2/orders
73+
74+
### Orders - Get by Key - Version 2.0
75+
# Get a specific order by ID for version 2.0
76+
GET {{baseUrl}}/api/v2/orders/1
77+
78+
### Orders - Get All - Version 3.0
79+
# Get all orders for version 3.0
80+
GET {{baseUrl}}/api/v3/orders
81+
82+
### Orders - Get by Key - Version 3.0
83+
# Get a specific order by ID for version 3.0
84+
GET {{baseUrl}}/api/v3/orders/1
85+
86+
### Orders - Get All with $expand - Version 3.0
87+
# Get orders with expanded customer details
88+
GET {{baseUrl}}/api/v3/orders?$expand=customer
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
###
2+
# BasicODataWebApiExample - ASP.NET OData Web API with Versioning
3+
# This example demonstrates basic OData endpoints with API versioning for legacy ASP.NET Web API
4+
###
5+
6+
@baseUrl = http://localhost:52667
7+
8+
### People - Get All - Version 1.0
9+
# Get all people using OData query
10+
GET {{baseUrl}}/api/people?api-version=1.0
11+
12+
### People - Get All with $select - Version 1.0
13+
# Get all people with specific fields
14+
GET {{baseUrl}}/api/people?api-version=1.0&$select=FirstName,LastName
15+
16+
### People - Get All with $filter - Version 1.0
17+
# Get filtered people
18+
GET {{baseUrl}}/api/people?api-version=1.0&$filter=Id eq 1
19+
20+
### People - Get by Key - Version 1.0
21+
# Get a specific person by ID
22+
GET {{baseUrl}}/api/people/1?api-version=1.0
23+
24+
### People - Get All - Version 2.0
25+
# Get all people using OData query
26+
GET {{baseUrl}}/api/people?api-version=2.0
27+
28+
### People - Get All with $select - Version 2.0
29+
# Get all people with specific fields
30+
GET {{baseUrl}}/api/people?api-version=2.0&$select=FirstName,LastName,Email
31+
32+
### People - Get by Key - Version 2.0
33+
# Get a specific person by ID
34+
GET {{baseUrl}}/api/people/1?api-version=2.0
35+
36+
### People - Patch - Version 2.0
37+
# Update a person using OData PATCH
38+
PATCH {{baseUrl}}/api/people/1?api-version=2.0
39+
Content-Type: application/json
40+
41+
{
42+
"firstName": "Jane",
43+
"email": "[email protected]"
44+
}
45+
46+
### Orders - Get All - Version 1.0
47+
# Get all orders
48+
GET {{baseUrl}}/api/v1/orders
49+
50+
### Orders - Get All with $select - Version 1.0
51+
# Get orders with specific fields
52+
GET {{baseUrl}}/api/v1/orders?$select=Id,Customer
53+
54+
### Orders - Get by Key - Version 1.0
55+
# Get a specific order by ID
56+
GET {{baseUrl}}/api/v1/orders/1
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
###
2+
# ConventionsODataWebApiExample - ASP.NET OData Web API with Convention-based Versioning
3+
# This example demonstrates OData endpoints configured using conventions for legacy ASP.NET Web API
4+
###
5+
6+
@baseUrl = http://localhost:52667
7+
8+
### People - Get All - Version 1.0
9+
# Get all people using OData query
10+
GET {{baseUrl}}/api/people?api-version=1.0
11+
12+
### People - Get All with $select - Version 1.0
13+
# Get all people with specific fields
14+
GET {{baseUrl}}/api/people?api-version=1.0&$select=FirstName,LastName
15+
16+
### People - Get All with $filter - Version 1.0
17+
# Get filtered people
18+
GET {{baseUrl}}/api/people?api-version=1.0&$filter=Id eq 1
19+
20+
### People - Get by Key - Version 1.0
21+
# Get a specific person by ID
22+
GET {{baseUrl}}/api/people/1?api-version=1.0
23+
24+
### People - Get All - Version 2.0
25+
# Get all people using OData query
26+
GET {{baseUrl}}/api/people?api-version=2.0
27+
28+
### People - Get All with $select - Version 2.0
29+
# Get all people with specific fields
30+
GET {{baseUrl}}/api/people?api-version=2.0&$select=FirstName,LastName,Email
31+
32+
### People - Get by Key - Version 2.0
33+
# Get a specific person by ID
34+
GET {{baseUrl}}/api/people/1?api-version=2.0
35+
36+
### People - Patch - Version 2.0
37+
# Update a person using OData PATCH
38+
PATCH {{baseUrl}}/api/people/1?api-version=2.0
39+
Content-Type: application/json
40+
41+
{
42+
"firstName": "Jane",
43+
"email": "[email protected]"
44+
}
45+
46+
### Orders - Get All - Version 1.0
47+
# Get all orders
48+
GET {{baseUrl}}/api/v1/orders
49+
50+
### Orders - Get All with $select - Version 1.0
51+
# Get orders with specific fields
52+
GET {{baseUrl}}/api/v1/orders?$select=Id,Customer
53+
54+
### Orders - Get by Key - Version 1.0
55+
# Get a specific order by ID
56+
GET {{baseUrl}}/api/v1/orders/1
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
###
2+
# OpenApiODataWebApiExample - ASP.NET OData Web API with OpenAPI/Swagger
3+
# This example demonstrates comprehensive OData endpoints with Swagger documentation for legacy ASP.NET Web API
4+
###
5+
6+
@baseUrl = http://localhost:52667
7+
8+
### Orders - Get by Key - Version 0.9 (Deprecated)
9+
# Get a specific order (deprecated version)
10+
GET {{baseUrl}}/api/orders/1?api-version=0.9
11+
12+
### Orders - Get by Key - Version 1.0
13+
# Get a specific order with $select option
14+
GET {{baseUrl}}/api/orders/1?api-version=1.0
15+
16+
### Orders - Get by Key with $select - Version 1.0
17+
# Get a specific order with selected fields
18+
GET {{baseUrl}}/api/orders/1?api-version=1.0&$select=Id,Customer
19+
20+
### Orders - Create - Version 1.0
21+
# Place a new order
22+
POST {{baseUrl}}/api/orders?api-version=1.0
23+
Content-Type: application/json
24+
25+
{
26+
"customer": "John Doe"
27+
}
28+
29+
### People - Get by Key - Version 1.0
30+
# Get a specific person
31+
GET {{baseUrl}}/api/people/1?api-version=1.0
32+
33+
### Orders - Get All - Version 2.0
34+
# Get all orders
35+
GET {{baseUrl}}/api/orders?api-version=2.0
36+
37+
### Orders - Get All with $select - Version 2.0
38+
# Get orders with specific fields
39+
GET {{baseUrl}}/api/orders?api-version=2.0&$select=Id,Customer
40+
41+
### Orders - Get by Key - Version 2.0
42+
# Get a specific order
43+
GET {{baseUrl}}/api/orders/1?api-version=2.0
44+
45+
### Orders - Create - Version 2.0
46+
# Place a new order with effective date
47+
POST {{baseUrl}}/api/orders?api-version=2.0
48+
Content-Type: application/json
49+
50+
{
51+
"customer": "Bob Smith",
52+
"effectiveDate": "2024-01-15T00:00:00Z"
53+
}
54+
55+
### People - Get All - Version 2.0
56+
# Get all people
57+
GET {{baseUrl}}/api/people?api-version=2.0
58+
59+
### People - Get All with $select - Version 2.0
60+
# Get people with specific fields
61+
GET {{baseUrl}}/api/people?api-version=2.0&$select=FirstName,LastName,Email
62+
63+
### People - Get by Key - Version 2.0
64+
# Get a specific person with email
65+
GET {{baseUrl}}/api/people/1?api-version=2.0
66+
67+
### Orders - Get All - Version 3.0
68+
# Get all orders
69+
GET {{baseUrl}}/api/orders?api-version=3.0
70+
71+
### Orders - Get All with $filter - Version 3.0
72+
# Get filtered orders
73+
GET {{baseUrl}}/api/orders?api-version=3.0&$filter=Id gt 1
74+
75+
### Orders - Get by Key - Version 3.0
76+
# Get a specific order
77+
GET {{baseUrl}}/api/orders/1?api-version=3.0
78+
79+
### Orders - Create - Version 3.0
80+
# Place a new order
81+
POST {{baseUrl}}/api/orders?api-version=3.0
82+
Content-Type: application/json
83+
84+
{
85+
"customer": "Charlie Brown",
86+
"effectiveDate": "2024-02-01T00:00:00Z"
87+
}
88+
89+
### People - Get All - Version 3.0
90+
# Get all people with phone numbers
91+
GET {{baseUrl}}/api/people?api-version=3.0
92+
93+
### People - Get by Key - Version 3.0
94+
# Get a specific person with phone number
95+
GET {{baseUrl}}/api/people/1?api-version=3.0
96+
97+
### Products - Get All - Version 3.0
98+
# Get all products
99+
GET {{baseUrl}}/api/products?api-version=3.0
100+
101+
### Products - Get by Key - Version 3.0
102+
# Get a specific product
103+
GET {{baseUrl}}/api/products/1?api-version=3.0
104+
105+
### Suppliers - Get All - Version 3.0
106+
# Get all suppliers
107+
GET {{baseUrl}}/api/suppliers?api-version=3.0
108+
109+
### Suppliers - Get by Key - Version 3.0
110+
# Get a specific supplier
111+
GET {{baseUrl}}/api/suppliers/1?api-version=3.0
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
###
2+
# SomeOpenApiODataWebApiExample - ASP.NET OData Web API with Minimal OpenAPI
3+
# This example demonstrates a simple OData controller with OpenAPI support for legacy ASP.NET Web API
4+
###
5+
6+
@baseUrl = http://localhost:52667
7+
8+
### Books - Get All - Version 1.0
9+
# Get all books
10+
GET {{baseUrl}}/api/books?api-version=1.0
11+
12+
### Books - Get All with $select - Version 1.0
13+
# Get books with specific fields
14+
GET {{baseUrl}}/api/books?api-version=1.0&$select=Title,Author
15+
16+
### Books - Get All with $filter - Version 1.0
17+
# Get filtered books by author
18+
GET {{baseUrl}}/api/books?api-version=1.0&$filter=Author eq 'Leo Tolstoy'
19+
20+
### Books - Get All with $orderby - Version 1.0
21+
# Get books ordered by publication year
22+
GET {{baseUrl}}/api/books?api-version=1.0&$orderby=Published desc
23+
24+
### Books - Get All with $top - Version 1.0
25+
# Get top 3 books
26+
GET {{baseUrl}}/api/books?api-version=1.0&$top=3
27+
28+
### Books - Get by ID - Version 1.0
29+
# Get a specific book by ISBN
30+
GET {{baseUrl}}/api/books/9781847490599?api-version=1.0
31+
32+
### Books - Get by ID with $select - Version 1.0
33+
# Get a specific book with selected fields
34+
GET {{baseUrl}}/api/books/9781847490599?api-version=1.0&$select=Title,Published
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
###
2+
# BasicWebApiExample - ASP.NET Web API Versioning Examples
3+
# This file demonstrates basic API versioning scenarios for legacy ASP.NET Web API
4+
###
5+
6+
@baseUrl = http://localhost:52667
7+
8+
### ValuesController - Version 1.0
9+
# Get values using query string versioning
10+
GET {{baseUrl}}/api/values?api-version=1.0
11+
12+
### ValuesController - Version 2.0
13+
# Get values using query string versioning
14+
GET {{baseUrl}}/api/values?api-version=2.0
15+
16+
### HelloWorldController - Version 1.0
17+
# Get hello world with URL segment versioning
18+
GET {{baseUrl}}/api/v1.0/helloworld
19+
20+
### HelloWorldController - Get by ID - Version 1.0
21+
# Get hello world with specific ID
22+
GET {{baseUrl}}/api/v1.0/helloworld/42
23+
24+
### HelloWorldController - Create - Version 1.0
25+
# Create new hello world resource
26+
POST {{baseUrl}}/api/v1.0/helloworld
27+
Content-Type: application/json

0 commit comments

Comments
 (0)