-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlink-headers.http
More file actions
105 lines (75 loc) · 2.69 KB
/
Copy pathlink-headers.http
File metadata and controls
105 lines (75 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# AGD Link Relations — Example HTTP Headers
#
# These examples demonstrate governance Link headers as defined in
# docs/agd-link-relations.md
### Example 1: Full governance links on a successful API response
GET /v1/data HTTP/1.1
Host: api.example.com
Accept: application/json
---
HTTP/1.1 200 OK
Content-Type: application/json
Link: <https://example.com/terms>; rel="terms-of-service"
Link: <https://example.com/aup>; rel="acceptable-use-policy"
Link: <https://example.com/privacy>; rel="privacy-policy"
Link: <https://example.com/compliance>; rel="compliance-policy"
Link: <https://api.example.com/.well-known/api-governance>; rel="api-governance"
{"status": "ok", "data": []}
### Example 2: Combined Link header
GET /v1/status HTTP/1.1
Host: api.example.com
---
HTTP/1.1 200 OK
Content-Type: application/json
Link: <https://example.com/terms>; rel="terms-of-service",
<https://example.com/aup>; rel="acceptable-use-policy",
<https://example.com/privacy>; rel="privacy-policy",
<https://api.example.com/.well-known/api-governance>; rel="api-governance"
{"status": "healthy"}
### Example 3: Governance links on rate limit error
GET /v1/data HTTP/1.1
Host: api.example.com
Authorization: Bearer token123
---
HTTP/1.1 429 Too Many Requests
Retry-After: 60
Content-Type: application/json
Link: <https://example.com/aup>; rel="acceptable-use-policy"
Link: <https://api.example.com/.well-known/api-governance>; rel="api-governance"
Link: <mailto:abuse@example.com>; rel="abuse-contact"
{"error": "rate_limit_exceeded", "message": "Rate limit exceeded. See acceptable use policy."}
### Example 4: Governance links on authentication error
POST /v1/transactions HTTP/1.1
Host: api.example.com
Content-Type: application/json
{"to": "0x...", "value": "1000000"}
---
HTTP/1.1 401 Unauthorized
Content-Type: application/json
Link: <https://example.com/terms>; rel="terms-of-service"
Link: <https://api.example.com/.well-known/api-governance>; rel="api-governance"
{"error": "unauthorized", "message": "Authentication required."}
### Example 5: AGD Core discovery endpoint response
GET /.well-known/api-governance HTTP/1.1
Host: api.example.com
Accept: application/json
---
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: public, max-age=3600
{
"version": "1.0",
"operator": {
"name": "Example Corp",
"website": "https://example.com"
},
"termsOfService": "https://example.com/terms",
"acceptableUsePolicy": "https://example.com/aup",
"privacyPolicy": "https://example.com/privacy",
"compliancePolicy": "https://example.com/compliance",
"jurisdiction": "California, USA",
"contact": {
"abuse": "abuse@example.com",
"legal": "legal@example.com"
}
}