Loading...
Loading...
Strict JSON:API v1.1 specification compliance. Trigger: When creating or modifying API endpoints, reviewing API responses, or validating JSON:API compliance.
npx skill4agent add prowler-cloud/prowler jsonapidjango-drf| Skill | Focus |
|---|---|
| What the spec requires (MUST/MUST NOT rules) |
| How to implement it in DRF (code patterns) |
mcp_context7_resolve-library-id(query="jsonapi specification")
mcp_context7_query-docs(libraryId="<resolved-id>", query="[specific topic: relationships, errors, etc.]")WebFetch(url="https://jsonapi.org/format/", prompt="Extract rules for [specific topic]")dataerrorsdataerrorsmetatypeididContent-Type: application/vnd.api+jsonAccept: application/vnd.api+jsonextprofileidtypeidtypeattributesattributesrelationshipslinksdatameta{"type": "...", "id": "..."}{"errors": [...]}status"400"400source.pointer| Operation | Success | Async | Conflict | Not Found | Forbidden | Bad Request |
|---|---|---|---|---|---|---|
| GET | | - | - | | | |
| POST | | | | | | |
| PATCH | | | | | | |
| DELETE | | | - | | | - |
| Code | Use When |
|---|---|
| Successful GET, PATCH with response body, DELETE with response |
| POST created resource (MUST include |
| Async operation started (return task reference) |
| Successful DELETE, PATCH with no response body |
| Invalid query params, malformed request, unknown fields |
| Authentication ok but no permission, client-generated ID rejected |
| Resource doesn't exist OR RLS hides it (never reveal which) |
| Duplicate ID, type mismatch, relationship conflict |
| Wrong Content-Type header |
{
"data": {
"type": "providers",
"id": "550e8400-e29b-41d4-a716-446655440000",
"attributes": {
"alias": "Production",
"connected": true
},
"relationships": {
"tenant": {
"data": {"type": "tenants", "id": "..."}
}
},
"links": {
"self": "/api/v1/providers/550e8400-..."
}
},
"links": {
"self": "/api/v1/providers/550e8400-..."
}
}{
"data": [
{"type": "providers", "id": "...", "attributes": {...}},
{"type": "providers", "id": "...", "attributes": {...}}
],
"links": {
"self": "/api/v1/providers?page[number]=1",
"first": "/api/v1/providers?page[number]=1",
"last": "/api/v1/providers?page[number]=5",
"prev": null,
"next": "/api/v1/providers?page[number]=2"
},
"meta": {
"pagination": {"count": 100, "pages": 5}
}
}{
"errors": [
{
"status": "400",
"code": "invalid",
"title": "Invalid attribute",
"detail": "UID must be 12 digits for AWS accounts",
"source": {"pointer": "/data/attributes/uid"}
}
]
}| Family | Format | Example |
|---|---|---|
| | |
| | |
| Comma-separated, | |
| | |
| Comma-separated paths | |
400400include400sortfields[type]| Violation | Wrong | Correct |
|---|---|---|
| ID as integer | | |
| Type as camelCase | | |
| FK in attributes | | |
| Errors not array | | |
| Status as number | | |
| Data + errors | | Only one or the other |
| Missing pointer | | |
PATCH /api/v1/providers/123/relationships/tenant
Content-Type: application/vnd.api+json
{"data": {"type": "tenants", "id": "456"}}{"data": null}| Operation | Method | Body |
|---|---|---|
| Replace all | PATCH | |
| Add members | POST | |
| Remove members | DELETE | |
include?include=provider{
"data": {
"type": "scans",
"id": "...",
"relationships": {
"provider": {
"data": {"type": "providers", "id": "prov-123"}
}
}
},
"included": [
{
"type": "providers",
"id": "prov-123",
"attributes": {"alias": "Production"}
}
]
}django-drfprowler-test-api