{
	"info": {
		"_postman_id": "be61f79a-c2ec-4352-affe-993a203f4b85",
		"name": "Activate API documentation",
		"description": "This Postman Collection include all the useful endpoints to consume uh!ive Rest Activate API:\n\n- Authentication endpoint to our SSO portal\n- Listing calls\n- Accessing one call details\n    \n\n## Authentication\n\nA client ID and client secret are required to retrieve an Access Token. This Access Token must then be passed as Bearer when requesting the Activate API.\n\nThis collection shows the \"Get Access Token\" method, but a pre-request script is also included to automatically retrieve this Access Token on the main API endpoints.\n\nUpdate the Collection's Variables `ACTIVATE_CLIENT_ID` and `ACTIVATE_CLIENT_SECRET` with your own.\n\n## Further documentation\n\nA swagger is available here: [https://activate.uh.live/swagger](https://activate.uh.live/swagger)\n\nDocumentation with Python examples and more information about the endpoints : [https://docs.allo-media.net/activate-api/rest/](https://docs.allo-media.net/activate-api/rest/)",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
		"_exporter_id": "4236790"
	},
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "Get Access Token",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/x-www-form-urlencoded",
								"type": "text"
							}
						],
						"body": {
							"mode": "urlencoded",
							"urlencoded": [
								{
									"key": "grant_type",
									"value": "client_credentials",
									"type": "text"
								},
								{
									"key": "client_id",
									"value": "{{ACTIVATE_CLIENT_ID}}",
									"type": "text"
								},
								{
									"key": "client_secret",
									"value": "{{ACTIVATE_CLIENT_SECRET}}",
									"type": "text"
								}
							]
						},
						"url": {
							"raw": "https://id.uh.live/realms/uhlive/protocol/openid-connect/token",
							"protocol": "https",
							"host": [
								"id",
								"uh",
								"live"
							],
							"path": [
								"realms",
								"uhlive",
								"protocol",
								"openid-connect",
								"token"
							]
						}
					},
					"response": []
				}
			],
			"auth": {
				"type": "noauth"
			},
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"type": "text/javascript",
						"packages": {},
						"exec": [
							""
						]
					}
				},
				{
					"listen": "test",
					"script": {
						"type": "text/javascript",
						"packages": {},
						"exec": [
							""
						]
					}
				}
			]
		},
		{
			"name": "Calls",
			"item": [
				{
					"name": "List Calls",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "https://activate.uh.live/calls?status=void,qualified&limit=20&offset=0",
							"protocol": "https",
							"host": [
								"activate",
								"uh",
								"live"
							],
							"path": [
								"calls"
							],
							"query": [
								{
									"key": "status",
									"value": "void,qualified",
									"description": "Limits returned calls to the one with the specified statuses. Statuses must be separated by a comma.\nAllowed values: \"qualified\" and \"void\". Default [\"qualified\"]"
								},
								{
									"key": "limit",
									"value": "20",
									"description": "Maximum number of calls to return\nDefault value : 50"
								},
								{
									"key": "offset",
									"value": "0",
									"description": "Starting position of the query in relation to the complete set of unpaginated items\nDefault value : 0"
								},
								{
									"key": "order",
									"value": "qualified",
									"description": "Order in which calls will be returned.\nAllowed values: \"qualified\", \"timestamp\".\nAvailable values : qualified, timestamp\nDefault value : qualified",
									"disabled": true
								},
								{
									"key": "exclude",
									"value": "transcript_json",
									"description": "Exclude fields from the payload. Fields must be separated by a comma.\nAllowed values: \"timestamp\", \"created_at\", \"transcript_json\", \"in\", \"out\", \"campaign\", \"duration\", \"ivr_end\", \"visit\",\"status\", \"tracking_info\".",
									"disabled": true
								},
								{
									"key": "timestamp_from",
									"value": "2020-06-01T02:00:00Z",
									"description": "Limits returned calls to the ones with a value in timestamp greater than or equal to the ISO 8601 provided date. Example: 2020-06-01T02:00:00Z",
									"disabled": true
								},
								{
									"key": "timestamp_to",
									"value": "2020-06-01T02:00:00Z",
									"description": "Limits returned calls to the ones with a value in timestamp lower than or equal to the ISO 8601 provided date. Example: 2020-06-01T02:00:00Z",
									"disabled": true
								},
								{
									"key": "qualified_from",
									"value": "2020-06-01T02:00:00Z",
									"description": "Limits returned calls to the ones which have been qualified at a date greater than or equal to the ISO 8601 provided date. Example: 2020-06-01T02:00:00Z",
									"disabled": true
								},
								{
									"key": "qualified_to",
									"value": "2020-06-01T02:00:00Z",
									"description": "Limits returned calls to the ones which have been qualified at a date lower than or equal to the ISO 8601 provided date. Example: 2020-06-01T02:00:00Z",
									"disabled": true
								}
							]
						}
					},
					"response": []
				},
				{
					"name": "Call Detail",
					"request": {
						"method": "GET",
						"header": [],
						"url": {
							"raw": "https://activate.uh.live/calls/123-1234567890.123456",
							"protocol": "https",
							"host": [
								"activate",
								"uh",
								"live"
							],
							"path": [
								"calls",
								"123-1234567890.123456"
							]
						}
					},
					"response": []
				}
			]
		}
	],
	"auth": {
		"type": "bearer",
		"bearer": [
			{
				"key": "token",
				"value": "{{ACTIVATE_JWT_ACCESS_TOKEN}}",
				"type": "string"
			}
		]
	},
	"event": [
		{
			"listen": "prerequest",
			"script": {
				"type": "text/javascript",
				"packages": {},
				"exec": [
					"pm.sendRequest({",
					"    url: \"https://id.uh.live/realms/uhlive/protocol/openid-connect/token\",",
					"    method: 'POST',",
					"    header: {",
					"        'Content-Type': 'application/x-www-form-urlencoded'",
					"    },",
					"    body: {",
					"        mode: 'urlencoded',",
					"        urlencoded: [",
					"            {key: 'client_id', value: pm.collectionVariables.get(\"ACTIVATE_CLIENT_ID\")},",
					"            {key: 'grant_type', value: 'client_credentials'},",
					"            {key: 'client_secret', value: pm.collectionVariables.get(\"ACTIVATE_CLIENT_SECRET\")}",
					"        ]",
					"    }",
					"}, function (err, res) {",
					"    console.log(\"pre request\", pm.collectionVariables.get(\"ACTIVATE_CLIENT_ID\"), pm.collectionVariables.get(\"ACTIVATE_CLIENT_SECRET\"));",
					"    var jsonData = res.json();",
					"    console.log(jsonData)",
					"    pm.collectionVariables.set('ACTIVATE_JWT_ACCESS_TOKEN', jsonData.access_token);",
					"});",
					""
				]
			}
		},
		{
			"listen": "test",
			"script": {
				"type": "text/javascript",
				"packages": {},
				"exec": [
					""
				]
			}
		}
	],
	"variable": [
		{
			"key": "ACTIVATE_CLIENT_ID",
			"value": "my-activate-client-id",
			"type": "string"
		},
		{
			"key": "ACTIVATE_CLIENT_SECRET",
			"value": "some-secret",
			"type": "string"
		},
		{
			"key": "ACTIVATE_JWT_ACCESS_TOKEN",
			"value": ""
		}
	]
}