Skip to content

Instantly share code, notes, and snippets.

@samkim
Created March 17, 2022 05:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save samkim/eb380df1b100ab201e8f51b577993632 to your computer and use it in GitHub Desktop.
Save samkim/eb380df1b100ab201e8f51b577993632 to your computer and use it in GitHub Desktop.
Postman collection of Authzed v1 API
{
"info": {
"_postman_id": "9d908d06-1035-440d-a510-817884f03724",
"name": "Authzed API v1",
"description": "# SpiceDB\n\nSpiceDB is a [Zanzibar](https://authzed.com/blog/what-is-zanzibar/)-inspired open source database system for managing security-critical application permissions.\n\nDevelopers create a schema that models their permissions requirements and use a [client library](https://docs.authzed.com/reference/api#client-libraries) to apply the schema to the database, insert data into the database, and query the data to efficiently check permissions in their applications.\n\nFeatures that distinguish SpiceDB from other systems include:\n\n- Expressive [gRPC](https://buf.build/authzed/api) and [HTTP](https://petstore.swagger.io/?url=https://raw.githubusercontent.com/authzed/authzed-go/main/proto/apidocs.swagger.json) APIs for checking permissions, listing access, and powering devtools\n- An architecture faithful to [Google's Zanzibar paper](https://authzed.com/blog/what-is-zanzibar/), including resistance to the [New Enemy Problem](https://authzed.com/blog/new-enemies/)\n- An intuitive and expressive [schema language](https://docs.authzed.com/guides/schema) complete with a [playground](https://play.authzed.com) dev environment\n- A powerful graph engine that supports distributed, parallel evaluation\n- Pluggable storage that supports [in-memory](https://github.com/hashicorp/go-memdb), [PostgreSQL](https://www.postgresql.org), [CockroachDB](https://github.com/cockroachdb/cockroach) and [Cloud Spanner](https://cloud.google.com/spanner) (beta)\n- Deep observability with [Prometheus metrics](https://prometheus.io), structured logging, and [distributed tracing](https://opentelemetry.io)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Schema",
"item": [
{
"name": "Schema Write",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"schema\": \"definition user {}\\ndefinition document {\\nrelation writer: user\\nrelation viewer: user\\npermission write = writer\\npermission view = viewer + writer\\n }\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8443/v1/schema/write",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"schema",
"write"
]
}
},
"response": []
},
{
"name": "Schema Read",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"url": {
"raw": "http://localhost:8443/v1/schema/read",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"schema",
"read"
]
}
},
"response": []
}
],
"description": "Operations on a Permissions System's schema."
},
{
"name": "Permissions",
"item": [
{
"name": "Relationships Write",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"updates\": [\n {\n \"operation\": \"OPERATION_TOUCH\",\n \"relationship\": {\n \"resource\": {\n \"objectType\": \"document\",\n \"objectId\": \"topsecret1\"\n },\n \"relation\": \"writer\",\n \"subject\": {\n \"object\": {\n \"objectType\": \"user\",\n \"objectId\": \"alice\"\n }\n }\n }\n },\n {\n \"operation\": \"OPERATION_TOUCH\",\n \"relationship\": {\n \"resource\": {\n \"objectType\": \"document\",\n \"objectId\": \"topsecret1\"\n },\n \"relation\": \"viewer\",\n \"subject\": {\n \"object\": {\n \"objectType\": \"user\",\n \"objectId\": \"bob\"\n }\n }\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8443/v1/relationships/write",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"relationships",
"write"
]
}
},
"response": []
},
{
"name": "Relationships Read",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"consistency\": {\n \"minimizeLatency\": true\n },\n \"relationshipFilter\": {\n \"resourceType\": \"document\"\n }\n}\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8443/v1/relationships/read",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"relationships",
"read"
]
}
},
"response": []
},
{
"name": "Relationships Delete",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"relationshipFilter\": {\n \"resourceType\": \"document\",\n \"optionalResourceId\": \"topsecret1\",\n \"optionalRelation\": \"viewer\",\n \"optionalSubjectFilter\": {\n \"subjectType\": \"user\",\n \"optionalSubjectId\": \"bob\"\n }\n },\n \"optionalPreconditions\": [\n {\n \"operation\": \"OPERATION_MUST_MATCH\",\n \"filter\": {\n \"resourceType\": \"document\",\n \"optionalResourceId\": \"topsecret1\",\n \"optionalRelation\": \"viewer\"\n }\n }\n ]\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8443/v1/relationships/delete",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"relationships",
"delete"
]
}
},
"response": []
},
{
"name": "Permissions Check",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"consistency\": {\n \"minimizeLatency\": true\n },\n \"resource\": {\n \"objectType\": \"document\",\n \"objectId\": \"topsecret1\"\n },\n \"permission\": \"view\",\n \"subject\": {\n \"object\": {\n \"objectType\": \"user\",\n \"objectId\": \"alice\"\n }\n }\n}\n",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8443/v1/permissions/check",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"permissions",
"check"
]
}
},
"response": []
},
{
"name": "Permissions Expand",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"consistency\": {\n \"minimizeLatency\": true\n },\n \"resource\": {\n \"objectType\": \"document\",\n \"objectId\": \"topsecret1\"\n },\n \"permission\": \"view\"\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8443/v1/permissions/expand",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"permissions",
"expand"
]
}
},
"response": []
},
{
"name": "Lookup Resources",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"consistency\": {\n \"minimizeLatency\": true\n },\n \"resourceObjectType\": \"document\",\n \"permission\": \"view\",\n \"subject\": {\n \"object\": {\n \"objectType\": \"user\",\n \"objectId\": \"alice\"\n }\n }\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "http://localhost:8443/v1/permissions/resources",
"protocol": "http",
"host": [
"localhost"
],
"port": "8443",
"path": [
"v1",
"permissions",
"resources"
]
}
},
"response": []
}
],
"description": "Operations used to interact with permissions and relationships."
}
],
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "secrettoken",
"type": "string"
}
]
},
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
""
]
}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment