Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ef4/63604ddf0dda8f12bfc5588752ec6fa2 to your computer and use it in GitHub Desktop.
Save ef4/63604ddf0dda8f12bfc5588752ec6fa2 to your computer and use it in GitHub Desktop.
Example Postman Queries for Cardstack development
{
"id": "5ba0f46c-3604-4c4b-39b5-1e4e2272a0a2",
"name": "Cardstack Development",
"values": [
{
"enabled": true,
"key": "hub",
"value": "http://localhost:4200/cardstack",
"type": "text"
},
{
"enabled": true,
"key": "elasticsearch",
"value": "http://localhost:9200",
"type": "text"
}
],
"timestamp": 1497388085410,
"_postman_variable_scope": "environment",
"_postman_exported_at": "2017-06-13T21:13:21.171Z",
"_postman_exported_using": "Postman/4.11.1"
}
{
"variables": [],
"info": {
"name": "cardstack",
"_postman_id": "1162d2f5-5d10-6d4a-3610-10046a7c5f6e",
"description": "",
"schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
},
"item": [
{
"name": "Reset Elasticsearch",
"request": {
"url": "{{elasticsearch}}/_all",
"method": "DELETE",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": ""
},
"description": ""
},
"response": []
},
{
"name": "List Elasticsearch Indices",
"request": {
"url": "{{elasticsearch}}/_all",
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"data\": {\n\t\t\"type\": \"people\"\n\t}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Search Elasticsearch",
"request": {
"url": "{{elasticsearch}}/_search",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"query\": {\n\t\t\"bool\": {\n\t\t\t\"must\":[\n\t\t\t\t{\"terms\":{\"_type\":[\"articles\",\"people\"]}}\n\t\t\t\t\n\t\t\t\t\n\t\t\t],\n\t\t\t\"must_not\":[\n\t\t\t\t{ \"term\": { \"_type\": \"meta\"}}\n\t\t\t]\n\t\t}\n\t}\n}"
},
"description": ""
},
"response": []
},
{
"name": "List Content Types",
"request": {
"url": "{{hub}}/content-types",
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \t\"type\": \"articles\",\n \t\"attributes\": {\n \t\t\"title\":\"foo\"\n \t\n \t}\n }\n}"
},
"description": ""
},
"response": []
},
{
"name": "Create Field",
"request": {
"url": "{{hub}}/fields",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \t\"type\":\"fields\",\n \t\"id\": \"description\",\n \t\"attributes\": {\n \t \"field-type\": \"@cardstack/core-types::string\"\n \t}\n }\n}"
},
"description": ""
},
"response": []
},
{
"name": "Create Content Type",
"request": {
"url": "{{hub}}/content-types",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"type\": \"content-types\",\n \"id\": \"rentals\",\n \"relationships\": {\n \t\t\"fields\": {\n \t\t\"data\": [\n \t\t\t{ \"type\": \"fields\", \"id\": \"title\" }\n \t\t]\n \t}\n }\n}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Patch article",
"request": {
"url": "{{hub}}/articles/9ed572aecf9e2d9dea976f68b8e69467cd559186",
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"type\": \"articles\",\n \"id\": \"9ed572aecf9e2d9dea976f68b8e69467cd559186\",\n \"attributes\": {\n \"title\": \"this is the new title\"\n },\n \"meta\": {\n \"version\": \"ded25bb09bd531d4e7e10be5efd8df9526fcfe99\"\n }\n }\n}"
},
"description": ""
},
"response": []
},
{
"name": "Patch Content Type",
"request": {
"url": "{{hub}}/content-types/rentals",
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"type\": \"content-types\",\n \"id\": \"rentals\",\n \"relationships\": {\n \t\t\"fields\": {\n \t\t\"data\": [\n \t\t\t{ \"type\": \"fields\", \"id\": \"title\" },\n \t\t { \"type\": \"fields\", \"id\": \"owner\" },\n \t\t { \"type\": \"fields\", \"id\": \"city\" },\n \t\t { \"type\": \"fields\", \"id\": \"property-type\" },\n \t\t { \"type\": \"fields\", \"id\": \"bedrooms\" },\n \t\t { \"type\": \"fields\", \"id\": \"image\" },\n \t\t { \"type\": \"fields\", \"id\": \"description\" }\n \t\t]\n \t}\n },\n \"meta\": {\n \"version\": \"3f567447ec34c4e3b64c52f9f0db891cbe91aeaf\",\n \"hash\": \"67c10e2261b7fe9b49d7b894dcb454b0716d570f\"\n }\n}\n}"
},
"description": ""
},
"response": []
},
{
"name": "Search rentals",
"request": {
"url": {
"raw": "{{hub}}/rentals?q=seattle",
"auth": {},
"host": [
"{{hub}}"
],
"path": [
"rentals"
],
"query": [
{
"key": "q",
"value": "seattle",
"equals": true,
"description": ""
}
],
"variable": []
},
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \t\"type\": \"articles\",\n \t\"attributes\": {\n \t\t\"title\":\"foo\"\n \t\n \t}\n }\n}"
},
"description": ""
},
"response": []
},
{
"name": "Create Rental",
"request": {
"url": "{{hub}}/rentals",
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"description": ""
}
],
"body": {
"mode": "raw",
"raw": "{\n \"data\": {\n \"type\": \"rentals\",\n \"attributes\": {\n \"title\": \"Hello World\"\n }\n }\n}"
},
"description": ""
},
"response": []
}
]
}
@ef4
Copy link
Author

ef4 commented Jun 13, 2017

You can import these two files into Postman as a starting point for exploring the APIs of the Hub and elasticsearch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment