{
	"info": {
		"_postman_id": "c3a751a8-23bd-4e92-b7ba-2206358ff8ec",
		"name": "D3 - Register new Products",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"item": [
		{
			"name": "Request Access Token",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"var jsonData = pm.response.json();",
							"pm.environment.set(\"access_token\", jsonData.access_token);",
							"pm.environment.set(\"bearer\", \"bearer \" + jsonData.access_token);"
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/x-www-form-urlencoded"
					}
				],
				"body": {
					"mode": "urlencoded",
					"urlencoded": [
						{
							"key": "grant_type",
							"value": "client_credentials",
							"type": "text"
						},
						{
							"key": "client_id",
							"value": "{{clientId}}",
							"type": "text"
						},
						{
							"key": "client_secret",
							"value": "{{clientSecret}}",
							"type": "text"
						},
						{
							"key": "scope",
							"value": "aud:{{targetSystemClientId}} openid",
							"type": "text"
						}
					]
				},
				"url": {
					"raw": "https://portal.bosch-nexeed.com/iam/access-management/v1/tenants/{{tenantId}}/openid-connect/token",
					"protocol": "https",
					"host": [
						"portal",
						"bosch-nexeed",
						"com"
					],
					"path": [
						"iam",
						"access-management",
						"v1",
						"tenants",
						"{{tenantId}}",
						"openid-connect",
						"token"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Product 1",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							"\r",
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"protocolProfileBehavior": {
				"strictSSL": false
			},
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Authorization",
						"value": "{{bearer}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n  \"twinType\": \"New product\",\r\n  \"twinCategory\": \"Product\",\r\n  \"description\": \"Product 1\",\r\n  \"manufacturer\": \"ACME\",\r\n  \"localIdentifiers\": [\r\n    {\r\n      \"localIdentifierKeyPairs\": [\r\n        {\r\n          \"key\": \"SerialNo\",\r\n          \"value\": \"1111\"\r\n        }\r\n      ]\r\n    }\r\n  ]\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins"
					]
				}
			},
			"response": []
		},
		{
			"name": "Find TwinId of Product 1",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"var jsonData = pm.response.json();",
							"pm.environment.set(\"twinId\", jsonData.items[0].id);"
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "{{bearer}}"
					}
				],
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins?filter=eq(localIdentifiers.localIdentifierKeyPairs.SerialNo, \"1111\")",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins"
					],
					"query": [
						{
							"key": "filter",
							"value": "eq(localIdentifiers.localIdentifierKeyPairs.SerialNo, \"1111\")"
						}
					]
				}
			},
			"response": []
		},
		{
			"name": "Register Movement aspect for Product 1",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "{{bearer}}"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "default"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n    \"modelReference\": {\n        \"urn\": \"urn:samm:io.openmanufacturing.examples.movement:1.0.0#Movement\"\n    },\n    \"httpEndpoints\": [\n        {\n          \"url\": \"https://demo.bosch-semantic-stack.com/api/movement/{{twinId}}\",\n          \"type\": \"READ\"\n        }\n    ]\n}"
				},
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins/{{twinId}}/aspects",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins",
						"{{twinId}}",
						"aspects"
					]
				}
			},
			"response": []
		},
		{
			"name": "Register Vibration aspect for Product 1",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "{{bearer}}"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "default"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"modelReference\": {\n    \"urn\": \"urn:samm:com.bosch.nexeed.digitaltwin:1.0.0#Vibration\"\n  },\n  \"httpEndpoints\": [\n    {\n      \"url\": \"https://demo.bosch-semantic-stack.com/api/vibration/{{twinId}}\",\n      \"type\": \"READ\"\n    }\n  ]\n}"
				},
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins/{{twinId}}/aspects",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins",
						"{{twinId}}",
						"aspects"
					]
				}
			},
			"response": []
		},
		{
			"name": "Create Product 2",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							"\r",
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"protocolProfileBehavior": {
				"strictSSL": false
			},
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Authorization",
						"value": "{{bearer}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n  \"twinType\": \"New product\",\r\n  \"twinCategory\": \"Product\",\r\n  \"description\": \"Product 2\",\r\n  \"manufacturer\": \"ACME\",\r\n  \"localIdentifiers\": [\r\n    {\r\n      \"localIdentifierKeyPairs\": [\r\n        {\r\n          \"key\": \"SerialNo\",\r\n          \"value\": \"2222\"\r\n        }\r\n      ]\r\n    }\r\n  ]\r\n}",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins"
					]
				}
			},
			"response": []
		},
		{
			"name": "Find TwinId of Product 2",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							"var jsonData = pm.response.json();",
							"pm.environment.set(\"twinId\", jsonData.items[0].id);"
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "GET",
				"header": [
					{
						"key": "Authorization",
						"value": "{{bearer}}"
					}
				],
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins?filter=eq(localIdentifiers.localIdentifierKeyPairs.SerialNo, \"2222\")",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins"
					],
					"query": [
						{
							"key": "filter",
							"value": "eq(localIdentifiers.localIdentifierKeyPairs.SerialNo, \"2222\")"
						}
					]
				}
			},
			"response": []
		},
		{
			"name": "Register Temperature aspect for Product 2",
			"event": [
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Authorization",
						"value": "{{bearer}}"
					},
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "default"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\n  \"modelReference\": {\n    \"urn\": \"urn:samm:com.bosch.nexeed.digitaltwin:1.0.0#Temperature\"\n  },\n  \"httpEndpoints\": [\n    {\n      \"url\": \"https://demo.bosch-semantic-stack.com/api/temperature/{{twinId}}\",\n      \"type\": \"READ\"\n    }\n  ]\n}"
				},
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins/{{twinId}}/aspects",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins",
						"{{twinId}}",
						"aspects"
					]
				}
			},
			"response": []
		},
		{
			"name": "Register Vibration aspect for Product 2",
			"event": [
				{
					"listen": "prerequest",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				},
				{
					"listen": "test",
					"script": {
						"exec": [
							""
						],
						"type": "text/javascript"
					}
				}
			],
			"request": {
				"method": "POST",
				"header": [
					{
						"key": "Content-Type",
						"value": "application/json",
						"type": "text"
					},
					{
						"key": "Authorization",
						"value": "{{bearer}}",
						"type": "text"
					}
				],
				"body": {
					"mode": "raw",
					"raw": "{\r\n    \"modelReference\": {\r\n        \"urn\": \"urn:samm:com.bosch.nexeed.digitaltwin:1.0.0#Vibration\"\r\n    },\r\n    \"httpEndpoints\": [\r\n        {\r\n          \"url\": \"https://demo.bosch-semantic-stack.com/api/vibration/{{twinId}}\",\r\n          \"type\": \"READ\"\r\n        }\r\n    ]\r\n}\r\n  \r\n",
					"options": {
						"raw": {
							"language": "json"
						}
					}
				},
				"url": {
					"raw": "{{url}}/{{registryApiPath}}/{{registryApiVersion}}/{{tenantId}}/twins/{{twinId}}/aspects",
					"host": [
						"{{url}}"
					],
					"path": [
						"{{registryApiPath}}",
						"{{registryApiVersion}}",
						"{{tenantId}}",
						"twins",
						"{{twinId}}",
						"aspects"
					]
				}
			},
			"response": []
		}
	]
}
