Introducing the Diffusion Cloud REST API
July 9, 2020 | DiffusionData
Publish and Request Real-Time Data for Tens of Thousands of App Users or Sensors Via Simple HTTP in the Programming Language of Your Choice
Diffusion Cloud is used successfully by customers around the world to send billions of real-time messages each month. One of the most common type of feature requests we receive is to let customers expand their applications even further by supporting new programming languages and platforms.
In addition to the wide array of SDKs that we provide, there are always more popular languages for which we could develop an SDK for – Python, PHP, Go… – how should we choose?
Our answer was to develop a REST API to support all of them.
The new REST API for Diffusion Cloud (previously known as the Service API) provides a REST interface for publishing and requesting data. Now, the power of Diffusion is available to any programming language that can make an HTTP request.
While our Client SDKs are still the preferred mechanism for many high-performance integrations, developers can quickly start interacting, prototyping, and launching services with Diffusion Cloud in minutes thanks to our simple new REST API. Better yet, since the REST API sits on top of our existing Diffusion Cloud services, you can easily mix & match your application types – publish real-time events using our SDKs and query from a REST client, or have thousands of IoT sensors sending updates via HTTP and use a topic view to dynamically transform and ingest that data to a back-end service.
To start using the REST API, log into your Cloud account, go to the Service Dashboard (select MANAGE on any Cloud service) and then select ADAPTERS > SERVICE API.
Don’t have a Cloud account yet? Sign up here.
Python
//Update topic requests.post('https://api.diffusion.cloud/topics/set', headers={ 'Authorization': 'Bearer ' + token }, json = { 'value': { 'latitude': 44.934, 'longitude': -93.262, "timestamp": 15903912 }, 'path': 'sensors/1032952' }) //Fetch topic var response = requests.post('https://api.diffusion.cloud/topics/fetch', headers={ 'Authorization': 'Bearer ' + token }, json = { selector: '?sensors/.*' }) print (response.json()[‘results])
PHP
//Update topic $client = new \GuzzleHttp\Client(["base_uri" => "https://api.diffusion.cloud"]); $client->post("/topics/set", [ 'headers' => ['Authorization' => 'Bearer '], 'json' => [ 'value' => ['latitude' => 44.934, 'longitude' => -93.262, "timestamp" => 15903912 ] 'path' => 'sensors/1032952' ] ]); //Fetch topic $client = new \GuzzleHttp\Client(["base_uri" => "https://api.diffusion.cloud"]); $response = $client->post("/topics/fetch", [ 'headers' => ['Authorization' => 'Bearer '], 'json' => [ 'selector' => '?sensors/.*'] ]); echo json_decode($response->getBody())[‘results’];
Push Technology’s corporate mission is to make it simple and easy to start using real-time data across any and all applications. We’re excited to see what our new REST API will enable our customers to achieve with Diffusion Cloud.
Our new REST API is the first of many steps that we have planned to ensure that open standards and ease-of-use remain an important part of your development experience with Diffusion Cloud.
Further reading
BLOG
Unlocking the Value of ISO 27001 Certification: A Journey of Security and Continuous Improvement
March 25, 2024
BLOG
100 million updates per second - Landmark Diffusion cluster performance
July 02, 2024
Read More about 100 million updates per second - Landmark Diffusion cluster performance/span>
BLOG
Exploring Generative AI: Opportunity or Potential Headache?
March 25, 2024
Read More about Exploring Generative AI: Opportunity or Potential Headache?/span>