How to connect sensor devices to IOTF using API KEYS - ibm-cloud

I am doing an android application, I'd like to know how to connect sensor devices/applications to Bluemix IoTF using API keys, by saying that I just want to minimize the registration task from client side(sensor devices)as much as possible. I know how to register devices with deivce Id,token and authentication manually. but I just like to know that is there any other easy way around to do it. It would be great If I got some one shed light on this from scratch. Thanks in advance.

There is a rich set of REST based APIs available at:
https://docs.internetofthings.ibmcloud.com/devices/api.html
and fully documented here:
https://docs.internetofthings.ibmcloud.com/swagger/v0002.html#/
One can use excellent REST based testing tools such as Postman for REST testing.
The reason I mention the REST APIs is that they provide a way for scripting or automating the registration of devices. There is an API called "Add device" that, when called, will register a new device instance of a specific device type against your IoT Foundation instance.
I could imagine a new device that knows it is not registered executing a self registration request to define itself as a new device type. What I would next suggest is that you read the links above and see if they make sense. If they answer your question fully, great. If not, simply post a new question that is specifically targeted at a specific areas and we'll be watching this set of tags and respond back as quickly as we can.

Related

Dynamically Change API Environments Google Rollout Track

I'm developing an Ionic(3 / 4)(Angular 4 - 7)-Cordova / Capacitor Cross Platform Application(s). I'm interested in switching API env based on the current rollout track in the Google Play Store. For example, once an application has been successfully tested and recommended to continue staging/production. I would like to have the API env dynamically changed (e.g., using a different URI domain to connect to REST API ) dependent on the Google Play Store Track.
I'm aware that I can use Google Developer Play Store API to identify / list versions and available tracks yet, I'm unaware if there's already an implementation or solution. I'm perfectly willing to design a solution though, I figure I find out if it's been done already rather than reinvent the wheel.
I'm hoping to implement a solution either to the REST API BACKEND or in the ionic framework layer rather than an integration at the native layer for scalability per-project. The purpose of doing this would enable CI rather than rebuilding the project and change the API URI domain for every environment. Any assistance in this matter would be greatly appreciated.
So, if anyone's interested. The approach highlighted above is possible, couldn't get an answer so I just created something. Using Google Play Developer API. The process flow is as follows:
[]
For now it's a working prototype perhaps its not very efficient; I suppose it can be improved if the request was issued from a single server, or microservice. Though, I wanted to make the code recyclable and it's isolated from both the mobile application & Node Server.
If you are interested in learning more or would like to work on project. Please feel free to contact me.

Trying to create a schema in IBM Watson IoT gives me 'Internal Error' - why..?

I'm trying to follow this guide: https://console.bluemix.net/docs/services/IoT/GA_information_management/ga_im_index_scenario.html#scenario
But as soon as I hit "Manage Schemas" in the device type section I get an "Internal Error", saying I should contact the Admin... I'm not able to create schemas. What's going wrong?
Thanks in advance!
Tom
It is not entirely clear what you are trying to achieve. If you are simply trying to retrieve the raw events that have been published by your device, then you need to use a URL for the form:
/api/v0002/device/types/{deviceType}/devices/{deviceId}/events/{eventName}
This is documented in the Watson IoT Platform API reference.
It is worth noting that, if this is all you are trying to achieve, you do not need to follow the guide that you referenced. It is possible to retrieve the raw events using the REST API simply by defining the Device Type and registering your device.
The guide that you referenced describes the Data Management capabilities of the Watson IoT Platform. These capabilities allow you to process the raw events in order to generate/compute state for the device. This is more involved than simply retrieving the raw events because you need to configure schemas for the events and the state and then define the mappings that tell the platform how to compute the properties on the state when an event is received. The computed state for a device is a different resource and needs to be retrieved using a different URL:
GET /api/v0002/device/types/{typeId}/devices/{deviceId}/state/{logicalInterfaceId}
This is documented here
It's a little confusing, but that Manage Schemas section of the UI is not related to the feature you're looking at as part of the guide you referred to.
The guide you're looking at outlines how to configure event schemas and logical interface schemas for a Device Type using REST API calls. If you wish to create this configuration using the web UI, this is possible too but you need to get to the Interfaces section from the Device Types view: see this image
In this case, I clicked on the Humidity Sensor Device Type and then, in the expanded view, clicked on the Interface tab. From there you can use the Simple or Advanced flows to create the configuration.
The reason for the error is because the component that provides the function on that page (Real time insights) is not present in the eu-de region. The page should not be present but for some reason is.
If you are planning on following that guide then this is a different part of the UI from the “manage schemas” page, and is located under the “interfaces” section in “device types”. The function defined in that guide is available in eu-de.

Connecting mobile app with back-end algorithm

I'm working on a school project. We have an AWS server set up with MongoDB. We created some user DB for account verification purposes and communicate with it using REST API. What we need is for the mobile app to send some data to the server side. Run it with an algorithm, then return back the result in JSON format. I've never done anything similar to this, so I have no idea how to go about it. If anyone could provide some lead or guidance/links that would be amazing. Thank you.
First of all you dont need a algorithm for it. It is just a process you have to follow and its kinda lot more easy than you thinking.
If you are doing it in android you can connect to rest webservice via Google's Volley http://developer.android.com/training/volley/index.html.
Or You can use Retrofit 2.0. I have been using it for a long time and i prefer it.
http://square.github.io/retrofit/

How to Send data to iPhone/Android from C# Web Service

I am trying to develop a cross platform app that uses a C# WCF web service. I have searched the web extensively but can't find anyone who has asked this question or posted a "how to" for this type of work flow.
For purposes of the question, let's focus on iPhone <--> Web Service interactions.
My app needs to do the following workflow:
iPhone#1 sends data to web service.
Web service pulls data from iPhone#2.
Web service does some calculations based on data from iPhone#1 and iPhone#2.
Web service sends results to iPhone#1 and iPhone#2.
iPhone#1 and iPhone#2 display results to users.
Steps 1, 3, and 5 are easy but how can I perform #2 and #4 above (requesting data from phone and sending data to phone)?
I don't necessarily need code samples, just a push in the right direction. Any help is much appreciated.
Thanks,
JVC
I was able to figure this out a while back and figured I would mention the solution in case anyone else runs across this.
In the most general sense, situations like this require the use of push notifications since they can be used to display a push notification on the device, or to send data packages to the phone for use in the app.
I ended up using Google's Cloud Messaging Service. It was very easy to implement and works like a champ.
Here is a link to the site with all of the proper documentation and guides: https://developers.google.com/cloud-messaging/

Generating Dynamically OpenTok Session ID from iOS

I am using OpenTokSDK for iPhone (using it Natively)
I have made the code for calling but just there is one problem.:-
I have to statically Add the SessionID. But i want to generate the ID Dynamically.
How can I do this ?
Please help!
Thanks In Advance
Full disclosure: I am a developer for TokBox.
The only safe way to get session ID and token credentials to the device is by developing an application server that suits the specific needs of your app. We have a number of server-side SDKs available on GitHub (link) that will interface with the OpenTok server API to generate this data.
Note well the server-side SDK is enough to get your credentials generated, but not all devices will be on the same session, so things like user management and application workflows are all considerations that cannot be easily written to an open source library.
That said, we did try to make some of these examples more clear by writing code examples on our blog (link). You can relieve much of the overhead of writing your own application server (no doubt a daunting task, especially the first time around) by leveraging one of the third party signaling services available, like Parse and Pusher, to name two.
Wobbals is correct, and In addition to what Wabbals has mentioned, generating sessions/tokens is very simple, the sample code required for each server language (PHP, NodeJS, C#, Ruby) is located in OpenTok's Github page.
Furthermore, if you choose not to have server side code and use Parse to handle your back-end, there is a wonderful writeup about how to use Parse's cloud code module for OpenTok to generate sessions and tokens.
Good Luck!
I strongly felt that the tokbox tutorial was quite basic but had steeper learning curve. So I ended up wrote out my own app-cum-tutorial.
Though late, I felt compelled to post here:
How To write your first iPhone Video Chat App using parse and opentok(tokbox)