{
	"info": {
		"_postman_id": "270f938d-f493-444e-9a95-b542e0df7af7",
        "name": "brainX REST API",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Login",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test(\"Set token\", function () {\r",
							"    var jsonData = pm.response.json();\r",
							"    pm.environment.set(\"token\", jsonData.data.accessToken);\r",
							"    pm.environment.set(\"refresh_token\", jsonData.data.refreshToken);\r",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Accept",
						"value": "application/vnd.brainformatik.crm-v1+json",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"user\": \"{{userName}}\",\r\n    \"password\": \"{{password}}\"\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/api/auth",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"auth"
					]
				}
			},
			"response": []
		},
		{
			"name": "Logout",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test(\"Set token\", function () {\r",
							"    var jsonData = pm.response.json();\r",
							"    pm.environment.set(\"token\", null);\r",
							"    pm.environment.set(\"refresh_token\", null);\r",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "DELETE",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{url}}/api/auth",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"auth"
					]
				}
			},
			"response": []
		},
		{
			"name": "Refresh",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"pm.test(\"Set token\", function () {\r",
							"    var jsonData = pm.response.json();\r",
							"    pm.environment.set(\"token\", jsonData.data.accessToken);\r",
							"    pm.environment.set(\"refresh_token\", jsonData.data.refreshToken);\r",
							"});"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"refreshToken\": \"{{refresh_token}}\"\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/api/auth/refresh",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"auth",
						"refresh"
					]
				}
			},
			"response": []
		},
		{
			"name": "Current user",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{url}}/api/users/current",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"users",
						"current"
					]
				}
			},
			"response": []
		},
		{
			"name": "Entities",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{url}}/api/metadata/entities",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"metadata",
						"entities"
					]
				}
			},
			"response": []
		},
		{
			"name": "Single Entity",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"type": "text",
						"value": "Bearer {{token}}"
					}
				],
				"url": {
					"raw": "{{url}}/api/metadata/entities/6",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"metadata",
						"entities",
						"6"
					]
				}
			},
			"response": []
		},
		{
			"name": "Get all",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{url}}/api/entity/6/records",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"entity",
						"6",
						"records"
					]
				}
			},
			"response": []
		},
		{
			"name": "Get one",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{url}}/api/entity/6/records/1415",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"entity",
						"6",
						"records",
						"1415"
					]
				}
			},
			"response": []
		},
		{
			"name": "Delete one",
			"request": {
				"method": "DELETE",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{url}}/api/entity/4/records/<id>",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"entity",
						"4",
						"records",
						"<id>"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"accountname\": \"Change me\",\r\n    \"assigned_user_id\": 1\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/api/entity/6/records",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"entity",
						"6",
						"records"
					]
				}
			},
			"response": []
		},
		{
			"name": "Update",
			"request": {
				"method": "PATCH",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"accountname\": \"You changed me\"\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/api/entity/6/records/<id>",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"entity",
						"6",
						"records",
						"<id>"
					]
				}
			},
			"response": []
		},
		{
			"name": "Relations",
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"url": {
					"raw": "{{url}}/api/relations/1830",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"relations",
						"1830"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create relations",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"records\": [\r\n        1856\r\n    ]\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/api/relations/1830",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"relations",
						"1830"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Pot",
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "Bearer {{token}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"potentialname\": \"Über neuen Service\",\r\n    \"assigned_user_id\": 1,\r\n    \"closingdate\": \"2021-07-31T00:00:00+0000\",\r\n    \"related_to\": 1016,\r\n    \"sales_stage\": \"Value Proposition\",\r\n    \"record_currency_id\": 405,\r\n    \"lineItems\": [\r\n        {\r\n            \"entityId\": 1516,\r\n            \"productName\": \"Product for Invoice\",\r\n            \"listPrice\": 2500,\r\n            \"quantity\": 3,\r\n            \"comment\": \"This is some random comment!\",\r\n            \"discountPercent\": 10,\r\n            \"taxClass\": 412,\r\n            \"productBlockName\": \"ArticleList1\"\r\n        },\r\n        {\r\n            \"entityId\": 1515,\r\n            \"productName\": \"Service for Invoice\",\r\n            \"listPrice\": 210,\r\n            \"quantity\": 2,\r\n            \"comment\": \"This is another random comment!\",\r\n            \"discountAmount\": 10,\r\n            \"taxClass\": 413,\r\n            \"optionalLineItem\": true,\r\n            \"productBlockName\": \"ArticleList1\"\r\n        },\r\n        {\r\n            \"entityId\": 1509,\r\n            \"productName\": \"The main product\",\r\n            \"listPrice\": 2500,\r\n            \"quantity\": 3,\r\n            \"comment\": \"This is some random comment!\",\r\n            \"discountPercent\": 10,\r\n            \"taxClass\": 412,\r\n            \"alternativeParentNumber\": 1,\r\n            \"productBlockName\": \"article_list_2\"\r\n        },\r\n        {\r\n            \"entityId\": 1509,\r\n            \"productName\": \"The main product\",\r\n            \"listPrice\": 2500,\r\n            \"quantity\": 3,\r\n            \"comment\": \"This is some random comment!\",\r\n            \"discountPercent\": 10,\r\n            \"taxClass\": 412,\r\n            \"alternativeParentIdentifier\": 1\r\n        }\r\n    ]\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/api/entity/2/records",
					"host": [
						"{{url}}"
					],
					"path": [
						"api",
						"entity",
						"2",
						"records"
					]
				}
			},
			"response": []
		}
	]
}