{"info":{"_postman_id":"ce8cdaaf-e082-4860-854a-2d66a3854e51","name":"FIWARE Context Providers","description":"This tutorial builds on the **Store** entity created in the previous [stock management example](https://github.com/Fiware/tutorials.CRUD-Operations/) and enables a user to \nretrieve data about a store which is not held directly within the Orion Context Broker.\n\nThe `docker-compose` file for this tutorial can be found on GitHub: \n\n![GitHub](https://fiware.github.io/tutorials.Context-Providers/icon/GitHub-Mark-32px.png) [FIWARE 104: Registering Context Providers](https://github.com/Fiware/tutorials.Context-Providers)\n\n# Context Providers\n\n> \"Knowledge is of two kinds. We know a subject ourselves, or we know where we can find information about it.\"\n>\n> — Samuel Johnson (Boswell's Life of Johnson)\n\n\nWithin the FIWARE platform, an entity represents the state of a physical or conceptural object which exists in the real world. \nFor example, a **Store** is a real world bricks and mortar building.\n\nThe context data of that entity defines the state of that real-world object at a given moment in time. \n\nIn all of the tutorials so far, we are holding all of the context data for our **Store** entities directly within the Orion \nContext Broker, for example stores would have attributes such as:\n\n* A unique identifier for the store e.g. `urn:ngsi-ld:Store:002`\n* The name of the store e.g. \"Checkpoint Markt\"\n* The address \"Friedrichstraße 44, 10969 Kreuzberg, Berlin\"\n* A physical location  e.g. *52.5075 N, 13.3903 E*\n\nAs you can see, most of these attributes are completely static (such as the location) and the others are unlikely to be\nchanged on a regular basis - though a street could be renamed, or the store name could be rebranded.\n\nThere is however another class of context data about the **Store** entity which is much more dynamic, information such as:\n\n* The current temperature at the store location\n* The current relative humidity at the store location\n* Recent social media tweets regarding the store \n\nThis information is always changing, and if it were held in a database, the data would always be out-of-date. To keep the context\ndata fresh, and to be able to retrieve the current state of the system on demand, new values for these dynamic data attributes will \nneed to be retrieved whenever the entity context is requested.\n\nSmart solutions are designed to react on the current state of the real-world. They are \"aware\" since they rely on dynamic data readings from \nexternal sources (such social media, IoT sensors, user inputs). The FIWARE platform makes the gathering and presentation of real-time \ncontext data transparent, since whenever an [NGSI](https://swagger.lab.fiware.org/?url=https://raw.githubusercontent.com/Fiware/specifications/master/OpenAPI/ngsiv2/ngsiv2-openapi.json) request is made to the Orion Context\nBroker it will always return the latest context by combining the data held within its database along with real-time data readings from \nany registered external context providers.\n\nIn order to be able to fulfil these requests, the Orion Context Broker, must first be supplied with two types of information:\n\n* The static context data held within Orion itself  (*Entities that Orion \"knows\" about*) \n* Registered external context providers associated with existing entities (*Entities that Orion can \"find information\" about*) \n\n\n## Entities within a stock management system\n\n\nWithin our simple stock management system, our **Store** entity currently returns `id`, `name`,  `address` and `location` attributes. \nWe will augment this with additional real-time context data from the following free publicly available data sources:\n\n* The temperature and relative humidity from the [Weather Underground API](https://www.wunderground.com/weather/api/d/docs?MR=1)\n* Recent social media tweets regarding the store from the [Twitter API](https://developer.twitter.com/](https://developer.twitter.com/)\n\nThe relationship between our entities is defined as shown:\n\n![](https://fiware.github.io/tutorials.Context-Providers/img/entities.png)\n\n# Architecture\n\nThis application will only make use of one FIWARE component - the [Orion Context Broker](https://catalogue.fiware.org/enablers/publishsubscribe-context-broker-orion-context-broker). Usage of the Orion Context Broker is sufficient for an application to qualify as *“Powered by FIWARE”*.\n\nCurrently, the Orion Context Broker relies on open source [MongoDB](https://www.mongodb.com/) technology to keep persistence of the context data it holds. \nTo request context data from external sources, we will now need to add a simple Context Provider NGSI proxy.\n\n\nTherefore, the architecture will consist of three elements:\n\n* The Orion Context Broker server which will receive requests using [NGSI](https://swagger.lab.fiware.org/?url=https://raw.githubusercontent.com/Fiware/specifications/master/OpenAPI/ngsiv2/ngsiv2-openapi.json)\n* The underlying MongoDB database associated to the Orion Context Broker server\n* The Context Provider NGSI proxy which will will:\n  + receive requests using [NGSI](https://swagger.lab.fiware.org/?url=https://raw.githubusercontent.com/Fiware/specifications/master/OpenAPI/ngsiv2/ngsiv2-openapi.json)\n  + makes requests to publicly available data sources using their own APIs in a proprietory format \n  + returns context data back to the Orion Context Broker in [NGSI](https://swagger.lab.fiware.org/?url=https://raw.githubusercontent.com/Fiware/specifications/master/OpenAPI/ngsiv2/ngsiv2-openapi.json) format.\n\nSince all interactions between the elements are initiated by HTTP requests, the entities can be containerized and run from exposed ports. \n\n![](https://fiware.github.io/tutorials.Context-Providers/img/architecture.png)\n\nThe necessary configuration information for the **Context Provider NGSI proxy** can be seen in the services section the of the associated `docker-compose.yml`  file:\n\n```yaml\n  context-provider:\n    image: fiware/cp-web-app:latest\n    hostname: context-provider\n    container_name: context-provider\n    networks:\n        - default\n    expose:\n        - \"3000\"\n    ports:\n        - \"3000:3000\"\n    environment:\n        - \"DEBUG=proxy:*\"\n        - \"PORT=3000\" \n        - \"CONTEXT_BROKER=http://orion:1026/v2\" \n        - \"WUNDERGROUND_KEY_ID=<ADD_YOUR_KEY_ID>\"\n        - \"TWITTER_CONSUMER_KEY=<ADD_YOUR_CONSUMER_KEY>\"\n        - \"TWITTER_CONSUMER_SECRET=<ADD_YOUR_CONSUMER_SECRET>\"\n```\n\nThe `context-provider` container is driven by environment variables as shown:\n\n| Key |Value|Description|\n|-----|-----|-----------|\n|DEBUG|`proxy:*`| Debug flag used for logging |\n|PORT|`3000`|Port used by the content provider proxy and web-app for viewing data |\n|CONTEXT_BROKER|`http://orion:1026/v2`| URL of the context broker to  connect to update context|\n|WUNDERGROUND_KEY_ID|`<ADD_YOUR_KEY_ID>`| A consumer key used to obtain access to the Weather Underground API|\n|TWITTER_CONSUMER_KEY|`<ADD_YOUR_CONSUMER_KEY>`| A consumer key used to obtain access to the Twitter API|\n|TWITTER_CONSUMER_SECRET|`<ADD_YOUR_CONSUMER_SECRET>`| A user key used to obtain access to the Twitter API |\n\nThe other `context-provider` container configuration values described in the YAML file are not used in this tutorial.\n\n\nThe configuration information for MongoDB and the Orion Context Broker\nhas been described in a [previous tutorial](https://github.com/Fiware/tutorials.Entity-Relationships/)\n\n# Prerequisites\n\n## Docker\n\nTo keep things simple both components will be run using [Docker](https://www.docker.com). **Docker** is a container technology which allows to different components isolated into their respective environments. \n\n* To install Docker on Windows follow the instructions [here](https://docs.docker.com/docker-for-windows/)\n* To install Docker on Mac follow the instructions [here](https://docs.docker.com/docker-for-mac/)\n* To install Docker on Linux follow the instructions [here](https://docs.docker.com/install/)\n\n**Docker Compose** is a tool for defining and running multi-container Docker applications. A [YAML file](https://raw.githubusercontent.com/Fiware/tutorials.Entity-Relationships/master/docker-compose.yml) is used configure the required\nservices for the application. This means all container sevices can be brought up in a single commmand. Docker Compose is installed by default as part of Docker for Windows and  Docker for Mac, however Linux users will need to follow the instructions found [here](https://docs.docker.com/compose/install/)\n\n## Cygwin \n\nWe will start up our services using a simple bash script. Windows users should download [cygwin](www.cygwin.com) to provide a command line functionality similar to a Linux distribution on Windows. \n\n## Context Provider NGSI proxy\n\nA simple [nodejs](https://nodejs.org/) [Express](https://expressjs.com/) application has been bundled as part of the repository. The application offers an NGSI v1 interface for four different context providers - the Weather Underground API, the Twitter Search API and two dummy data context providers - a static data provider (which always returns the same data) and a random data context provider (which will change every time it is invoked). \n\nMore information about the proxy endpoints can be found [here](https://github.com/Fiware/tutorials.Context-Providers/blob/master/proxy/README.md)\n\n* In order to access the Weather Underground API, you will need to sign up for a key at https://www.wunderground.com/weather/api/ \n* In order to access the Twitter Search API, you will have to create an app in Twitter via  https://apps.twitter.com/app/new to obtain a \nConsumer Key & Consumer Secret. \n\n\nReplace the placeholders in `docker-compose.yml` in the root of the repository with the values you obtain for your application:\n\n```yaml\n    environment:\n        - \"DEBUG=proxy:*\"\n        - \"WUNDERGROUND_KEY_ID=<ADD_YOUR_KEY_ID>\"\n        - \"TWITTER_CONSUMER_KEY=<ADD_YOUR_CONSUMER_KEY>\"\n        - \"TWITTER_CONSUMER_SECRET=<ADD_YOUR_CONSUMER_SECRET>\"\n```\n\nIf you do not wish to sign-up for an API key, you can use data from the random data context provider instead.\n\n# Start Up\n\nAll services can be initialised from the command line by running the bash script provided within the repository:\n\n```console\n./services create; ./services start;\n```\n\nThis command will also import seed data from the previous [Stock Management example](https://github.com/Fiware/tutorials.CRUD-Operations) on startup.","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item":[{"name":"Health Checks","item":[{"name":"Static Data Context Provider (Health Check)","id":"17ee9d41-b78f-4b6c-8d49-fdf7637f95e2","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://{{context-provider}}/health/static","description":"This example returns the health of the Static Data Context Provider endpoint.\n\nA non-error response shows that an NGSI proxy is available on the network and returning values.\nEach Request will return the same data."},"response":[],"_postman_id":"17ee9d41-b78f-4b6c-8d49-fdf7637f95e2"},{"name":"Random Data Context Provider (Health Check)","id":"b07bf5df-c6fb-40ac-9c45-1109246bc2ea","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://{{context-provider}}/health/random","description":"This example returns the health of the Random Data Generator Context Provider endpoint.\n\nA non-error response shows that an NGSI proxy is available on the network and returning values.\nEach Request will return some random dummy data."},"response":[],"_postman_id":"b07bf5df-c6fb-40ac-9c45-1109246bc2ea"},{"name":"Twitter API Context Provider (Health Check)","id":"00037fd1-6505-4b56-82b6-d63861eca32a","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://{{context-provider}}/health/twitter","description":"This example returns the health of the Twitter API Context Provider endpoint.\n\nA non-error response shows that an NGSI proxy for the Twitter API is available on the network and returning values.\n\nIf the proxy is correctly configured to connect to the Twitter API, a series of Tweets will be\nreturned.\n\nThe Twitter API uses OAuth2: \n* To get Consumer Key & Consumer Secret for the Twitter API, you have to create an app in Twitter via [https://apps.twitter.com/app/new](https://apps.twitter.com/app/new). Then you'll be taken to a page containing Consumer Key & Consumer Secret.\n* For more information see: [https://developer.twitter.com/](https://developer.twitter.com/)"},"response":[],"_postman_id":"00037fd1-6505-4b56-82b6-d63861eca32a"},{"name":"Weather API Context Provider (Health Check)","id":"67313dfc-c530-4a06-88d2-37d1276990a5","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://{{context-provider}}/health/weather","description":"This example returns the health of the Weather API Context Provider endpoint.\n\nA non-error response shows that an NGSI proxy for the Weather API is available on the network and returning values.\n\nIf the proxy is correctly configured to connect to the Weather Underground API, the current weather in Berlin will be returned.\n\nMost of the Weather API features require an API key. \n\n* Sign up for a key at [https://www.wunderground.com/weather/api/](https://www.wunderground.com/weather/api/)\n\n* For more information see: [https://www.wunderground.com/weather/api/d/docs?MR=1](https://www.wunderground.com/weather/api/d/docs?MR=1)"},"response":[],"_postman_id":"67313dfc-c530-4a06-88d2-37d1276990a5"},{"name":"Cat Facts API Context Provider (Health Check)","id":"b51782ce-4ae8-467c-8f10-591743c4962e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[],"url":"http://{{context-provider}}/health/catfacts","description":"This example returns the health of the Cat Facts API Context Provider endpoint.\n\nA non-error response shows that an NGSI proxy for the Cat Facts API is available on the network and returning values.\n\nIf the proxy is correctly configured to connect to the Cat Facts API, a series of facts about cats will be returned."},"response":[],"_postman_id":"b51782ce-4ae8-467c-8f10-591743c4962e"}],"id":"6bdafbe5-78b1-4ab7-911e-ac8d360cb21a","description":"The nodejs proxy application offers a `health` endpoint for each of the four context providers. Making a request to the appropriate endpoint will check that the provider is running and external data can be received. The application runs on port `3000`.","event":[{"listen":"prerequest","script":{"id":"2964a74c-f2c6-46ac-9c71-f929208fb5a0","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"4820111c-c261-4e96-8089-0fc8e5065867","type":"text/javascript","exec":[""]}}],"_postman_id":"6bdafbe5-78b1-4ab7-911e-ac8d360cb21a"},{"name":"Accessing the NGSI v2 QueryContext Endpoint","item":[{"name":"Retrieving a Single Attribute Value","id":"4215ed36-053e-4c6f-9c19-33c4d0a52372","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"entities\": [\n        {\n            \"type\": \"Store\",\n            \"isPattern\": \"false\",\n            \"id\": \"urn:ngsi-ld:Store:001\"\n        }\n    ],\n    \"attrs\": [\n        \"temperature\"\n    ]\n} "},"url":"http://{{context-provider}}/static/temperature/op/query","description":"This example uses the NGSI v2 `op/query` endpoint to request a `temperature` reading from the  Static Data Generator Context Provider.\n\nThe response will return a object of `type:Number` and `value:42`\n\nThe Orion Context Broker will make similar requests to this `op/query` endpoint once a context provider has been registered."},"response":[],"_postman_id":"4215ed36-053e-4c6f-9c19-33c4d0a52372"},{"name":"Retrieving Multiple Attribute Values","id":"556347e5-8271-4435-a34f-b7ed38a19a85","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"entities\": [\n        {\n            \"type\": \"Store\",\n            \"isPattern\": \"false\",\n            \"id\": \"urn:ngsi-ld:Store:001\"\n        }\n    ],\n    \"attrs\": [\n        \"temperature\",\n        \"relativeHumidity\"\n    ]\n} "},"url":"http://{{context-provider}}/random/weatherConditions/op/query","description":"It is possible for the Orion Context Broker to make a request for multiple data values. This example uses the NGSI NGSI v2 `op/query`  endpoint to request  `temperature` and `relativeHumidity` readings from the Random Data Generator Context Provider. The requested attributes are found within the `attributes` array of the POST body.\n\n\nThe response will return a object with values for both `temperature` and `relativeHumidity`\n\nThe Orion Context Broker will make similar requests to this `op/query` endpoint once a context provider has been registered."},"response":[],"_postman_id":"556347e5-8271-4435-a34f-b7ed38a19a85"},{"name":"Retrieving Live Weather Values","id":"28d10b6e-8ae6-4e71-81b1-798ada33e80b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"entities\": [\n        {\n            \"type\": \"Store\",\n            \"isPattern\": \"false\",\n            \"id\": \"urn:ngsi-ld:Store:001\"\n        }\n    ],\n    \"attrs\": [\n        \"temperature\",\n        \"relativeHumidity\"\n    ]\n} "},"url":"http://{{context-provider}}/random/weatherConditions/op/query","description":"This example uses the NGSI v2 `op/query`  endpoint to request temperature and relativeHumidity readings from the Weather API Context Provider. The requested attributes are found within the attributes array of the POST body.\n\nThe Orion Context Broker will make similar requests to this `op/query` endpoint once a context provider has been registered."},"response":[],"_postman_id":"28d10b6e-8ae6-4e71-81b1-798ada33e80b"},{"name":"Retrieving Live Tweets","id":"e8de9d27-d5f8-48c1-ab25-c4f0905c5651","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"entities\": [\n        {\n            \"type\": \"Store\",\n            \"isPattern\": \"false\",\n            \"id\": \"urn:ngsi-ld:Store:001\"\n        }\n    ],\n    \"attrs\": [\n        \"tweets\"\n    ]\n} "},"url":"http://{{context-provider}}/twitter/tweets/op/query","description":"This example uses the NGSI v2 `op/query`  endpoint to request tweets from the Twitter API Context Provider. The requested attributes are found within the attributes array of the POST body.\n\nThe Orion Context Broker will make similar requests to this queryContext `op/query`  once a context provider has been registered."},"response":[],"_postman_id":"e8de9d27-d5f8-48c1-ab25-c4f0905c5651"},{"name":"Retrieving Live Cat Facts","id":"029dee89-c5da-4e5c-841f-67e5c4dac761","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"entities\": [\n        {\n            \"type\": \"Store\",\n            \"isPattern\": \"false\",\n            \"id\": \"urn:ngsi-ld:Store:001\"\n        }\n    ],\n    \"attrs\": [\n        \"tweets\"\n    ]\n} "},"url":"http://{{context-provider}}/catfacts/tweets/op/query","description":"This example uses the NGSI v2 `op/query`  endpoint to request tweets from the Twitter API Context Provider. The requested attributes are found within the attributes array of the POST body.\n\nThe Orion Context Broker will make similar requests to this `op/query`  endpoint once a context provider has been registered."},"response":[],"_postman_id":"029dee89-c5da-4e5c-841f-67e5c4dac761"}],"id":"48b313c2-9bb3-467f-ac01-ad749b6b6592","description":"Because the `3000` port of the Context Provider has been exposed outside of the Docker container, it is possible for curl to make requests directly to the Context Provider - this simulates the requests that would have been made by the Orion Context Broker. You can also simulate making the requests as part of the docker container network by running the `appropriate/curl` Docker image.\n\nFirstly obtain the name of the network used within the Docker containers by running\n\n```console\ndocker network ls\n```\n\nThen run the following curl command including the `--network` parameter:\n\n```console\ndocker run --network fiware_default --rm appropriate/curl -X GET http://context-provider:3000/random/health\n```\n\nAs you can see, within the network, the host name of the Context Provider is `context-provider`.","event":[{"listen":"prerequest","script":{"id":"6c72a7b6-107b-4d17-98b8-41fa833c675a","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"d4f0cf7e-297b-4674-bc92-bcbe91c53b76","type":"text/javascript","exec":[""]}}],"_postman_id":"48b313c2-9bb3-467f-ac01-ad749b6b6592"},{"name":"Context Provider Registration Actions","item":[{"name":"Register a Context Provider - Weather","id":"601852dd-2a33-4bbc-a458-644a604c983f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n   \"description\": \"Get Weather data for Store 1\",\n   \"dataProvided\": {\n     \"entities\": [\n       {\n         \"id\" : \"urn:ngsi-ld:Store:001\",\n         \"type\": \"Store\"\n       }\n     ],\n     \"attrs\": [\n      \"temperature\", \"relativeHumidity\"\n    ]\n   },\n   \"provider\": {\n     \"http\": {\n       \"url\": \"http://context-provider:3000/random/weatherConditions\"\n     },\n     \"legacyForwarding\": false\n   },\n   \"status\": \"active\"\n}"},"url":{"raw":"http://{{orion}}/v2/registrations","protocol":"http","host":["{{orion}}"],"path":["v2","registrations"],"query":[{"key":"type","value":"Store","description":"Entity type, to avoid ambiguity in case there are several entities with the same entity id","disabled":true},{"key":"attrs","value":"name","description":"Ordered list of attribute names to display","disabled":true}]},"description":"This example registers the Random Data Context Provider with the Orion Context Broker.\n\nThe body of the request states that: *\"The URL* `http://context-provider:3000/proxy/v1/random/weatherConditions` *is capable of providing* `relativeHumidity`  and `temperature` *data for the entity called* `id=urn:ngsi-ld:Store:001`.*\"*\n\nThe values are **never** held within Orion, it is always requested on demand from the registered context provider. Orion merely holds the registration information about which context providers can offer context data.\n\nThis request will return with a **201 - Created** response code. The `Location` Header of the response contains a path to the registration record held in Orion.\n\n>*Note:* if you have registered with the Weather API, you can retrieve live values for `temperature` and `relativeHumidity` in Berlin by placing the following `url` in the `provider`:\n>\n> * `http://context-provider:3000/proxy/v1/weather/weatherConditions`\n>"},"response":[],"_postman_id":"601852dd-2a33-4bbc-a458-644a604c983f"},{"name":"Register a Context Provider - Tweets","id":"a4f4d07f-aa8f-4d54-a55d-397dd829447d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n   \"description\": \"Get Tweets for Store 1\",\n   \"dataProvided\": {\n     \"entities\": [\n       {\n         \"id\" : \"urn:ngsi-ld:Store:001\",\n         \"type\": \"Store\"\n       }\n     ],\n     \"attrs\": [\n      \"tweets\"\n    ]\n   },\n   \"provider\": {\n     \"http\": {\n       \"url\": \"http://context-provider:3000/catfacts/tweets\"\n     },\n     \"legacyForwarding\": false\n   },\n   \"status\": \"active\"\n}"},"url":{"raw":"http://{{orion}}/v2/registrations","protocol":"http","host":["{{orion}}"],"path":["v2","registrations"],"query":[{"key":"type","value":"Store","description":"Entity type, to avoid ambiguity in case there are several entities with the same entity id","disabled":true},{"key":"attrs","value":"name","description":"Ordered list of attribute names to display","disabled":true}]},"description":"This example registers the Cat Facts API Context Provider with the Orion Context Broker.\n\nThe body of the request states that: *\"The URL* `http://context-provider:3000/proxy/v1/catfacts/tweets` *is capable of providing* `tweets` *data for the entity called* `id=urn:ngsi-ld:Store:001`.*\"*\n\nThe values are **never** held within Orion, it is always requested on demand from the registered context provider. Orion merely holds the registration information about which context providers can offer context data.\n\nThis request will return with a **201 - Created** response code. The `Location` Header of the response contains a path to the registration record held in Orion.\n\n>*Note:* if you have registered with the Twitter API, you can retrieve live values for `tweets` in Berlin by placing the following `url` in the `provider`:\n>\n> * `http://context-provider:3000/proxy/v1/twitter/tweets`\n>"},"response":[],"_postman_id":"a4f4d07f-aa8f-4d54-a55d-397dd829447d"},{"name":"Read a registered content provider","id":"e730ed8e-2138-4ef8-b130-824326486760","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":{"raw":"http://{{orion}}/v2/registrations/5addeffd93e53f86d8264521","protocol":"http","host":["{{orion}}"],"path":["v2","registrations","5addeffd93e53f86d8264521"],"query":[{"key":"type","value":"Store","description":"Entity type, to avoid ambiguity in case there are several entities with the same entity id","disabled":true},{"key":"attrs","value":"name","description":"Ordered list of attribute names to display","disabled":true}]},"description":"This example reads  the registration data with the id `5addeffd93e53f86d8264521` from the context.\n\nRegistration data can be obtained by making a GET request to the `/v2/registrations/<entity>` endpoint."},"response":[],"_postman_id":"e730ed8e-2138-4ef8-b130-824326486760"},{"name":"List all registered content providers","id":"7a587072-8e4d-429d-b164-72ec06b514ca","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":{"raw":"http://{{orion}}/v2/registrations","protocol":"http","host":["{{orion}}"],"path":["v2","registrations"],"query":[{"key":"type","value":"Store","description":"Entity type, to avoid ambiguity in case there are several entities with the same entity id","disabled":true}]},"description":"This example lists all registered context providers\n\nFull context data  for a specified entity type can be retrieved by making a GET request to the `/v2/registrations/` endpoint."},"response":[],"_postman_id":"7a587072-8e4d-429d-b164-72ec06b514ca"},{"name":"Remove a registered content provider","id":"9ec487c1-2d08-415f-bc5b-c8d2655b77d8","request":{"method":"DELETE","header":[],"body":{"mode":"formdata","formdata":[]},"url":{"raw":"http://{{orion}}/v2/registrations/5ad5b9435c28633f0ae90671","protocol":"http","host":["{{orion}}"],"path":["v2","registrations","5ad5b9435c28633f0ae90671"],"query":[{"key":"type","value":"Store","description":"Entity type, to avoid ambiguity in case there are several entities with the same entity id","disabled":true},{"key":"attrs","value":"name","description":"Ordered list of attribute names to display","disabled":true}]},"description":"This example removes the registration with the id `5ad5b9435c28633f0ae90671` from the context.\n\nRegistrations can be deleted by making a DELETE request to the `/v2/registrations/<entity>` endpoint.\n\n---\nSubsequent requests using the same `id` will result in an error response since the entity no longer exists"},"response":[],"_postman_id":"9ec487c1-2d08-415f-bc5b-c8d2655b77d8"}],"id":"5d610d41-4779-4b65-91b1-31256c4e0eae","description":"All Context Provider Registration actions take place on the `v2/registrations` endpoint. The standatd CRUD mappings apply:\n\n* Creation is mapped to the HTTP POST\n* Reading/Listing registrations to HTTP GET verb\n* Deletion is mapped to HTTP DELETE","event":[{"listen":"prerequest","script":{"id":"ecb1fe44-a6ca-45f0-b04f-8fd08c24e916","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"fe5b4d0c-f893-45bc-b2ce-b128e18491f3","type":"text/javascript","exec":[""]}}],"_postman_id":"5d610d41-4779-4b65-91b1-31256c4e0eae"},{"name":"Reading Context Data","item":[{"name":"Obtain Store Information","id":"1706c713-90fc-4d3f-a53a-80713b9be2f1","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://{{orion}}/v2/entities/urn:ngsi-ld:Store:001","description":"This example reads the full context from the **Store** entity with the `id=urn:ngsi-ld:Store:001`.\n\nThe `relativeHumidity` attribute is returned as part of the context for the entity because a context provider has been registered to provide that data."},"response":[],"_postman_id":"1706c713-90fc-4d3f-a53a-80713b9be2f1"},{"name":"Obtain Store Humidity","id":"b65ff3ae-0e19-44c6-adb7-78c64bac5973","request":{"method":"GET","header":[],"body":{"mode":"formdata","formdata":[]},"url":"http://{{orion}}/v2/entities/urn:ngsi-ld:Store:001/attrs/relativeHumidity/value","description":"This example reads the value of the `relativeHumidity` attribute from the **Store** entity with the `id=urn:ngsi-ld:Store:001`.\n\nData is returned in the context because a context provider has been registered to provide that data."},"response":[],"_postman_id":"b65ff3ae-0e19-44c6-adb7-78c64bac5973"}],"id":"1d9c46bf-7028-4a8c-aa6a-9e36bb9f06af","description":"Once a Context Provider has been registered, the new context data will be included in the response if the context of the associated entity is requested.","event":[{"listen":"prerequest","script":{"id":"c43b57f2-84cc-4d57-8c6d-5b4260399699","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"cc26f7d9-301c-48e2-891f-3c336c18fe96","type":"text/javascript","exec":[""]}}],"_postman_id":"1d9c46bf-7028-4a8c-aa6a-9e36bb9f06af"}],"event":[{"listen":"prerequest","script":{"id":"343e1af9-161c-4ec3-ba3a-a63bf0296b92","type":"text/javascript","exec":[""]}},{"listen":"test","script":{"id":"dc4dca7c-b13f-475e-888f-046dafbba038","type":"text/javascript","exec":[""]}}],"variable":[{"key":"orion","value":"localhost:1026","type":"string"},{"key":"context-provider","value":"localhost:3000","type":"string"}]}