IBM Watson Devices HTTP API gives 403 continuously - ibm-watson

I am trying to use HTTP APIs mentioned in below link to access my IoT devices and their data: https://docs.internetofthings.ibmcloud.com/swagger/v0002.html#!/Organization_Configuration/get
I am using my 6 digit organization code to access these apis and I have created API Key from IBM Watson to access these apis.
I am attaching snapshot of postman REST Api client, which I am using to send request from my local database to server.
Thanks in advance.

Are you using the version 1 APIs for the Watson IoT Platform? Those were replaced by more powerful version 2 APIs last year and v1 has now been deprecated.

Delete your current api and create a new api from your IBM watson.
Copy that new api secret username and password at time of creation (as you can't see it once it's created) and put it to any rest client.
This worked for me!

Related

Connecting API to database

I am using this API to build an app (Xcode) and the maximum number of calls a day is 5000. The way I have currently built the app for testing purposes is to call the API every time the user refreshes the data. So, I am running out of calls per day. So, I was wondering how to connect an API to a database like firebase. Then update the data in the database maybe 4 times a day at a specific time. When the user would be refreshing, they would pull data from the database instead. I'm new to programming and am not sure if this is the best solution and would appreciate if anyone could direct me to more resources. Thanks!
This is the api I am using: https://projects.propublica.org/api-docs/congress-api/?
Edit: Also would something like this also mean I would build a REST API? https://github.com/unitedstates/congress It is a repository that includes data importing scripts and scrapers. I'm guessing this isn't compatible with swift but is compatible with building a REST API in AWS or Firebase?
You can use AWS (Amazon Web Services). Their free tier allows many of their services for free (12 months, and usage limit) including the ones I would recommend you for this project:
Make an AWS account.
Use S3 storage buckets to host a datafile.
Use API Gateway to make an API.
Use Lambda to run a Python/Javascript in the cloud which connects the API with the S3 bucket (your data).
Use IAM to create roles and permissions for the S3 bucket, API and Lambda scripts to communicate.
Here's how you set up the API: https://www.youtube.com/watch?v=uFsaiEhr1zs
Here's how you read the S3 bucket: https://www.youtube.com/watch?v=6LvtSmJhVRE
You can also work with these tools to set up an API that PUTS data to the S3 bucket and updates the data regularly.

Google cloud endpoints service is not listed in api library

I'm trying to share my API (with a custom domain) with the customer( service consumer role), but this API is not listed in the API library. When he tries to open API using the link to generate API key he gots errors. The same problem I have when I try to generate API key for customers. I'm using endpoints frameworks for the GAE standard environment. Image
This one looks more like a problem with the Cloud console or the Cloud APIs, I'd better address the issue at a Public Issue Tracker (PIT), you can open one in here, and preferably add a relevant HAR file that should contain some additional information of the response message.
This will help to correctly address any ongoing service issue.

Send Telemetry Data to Azure IoT Central Device using HTTP GET Requests

I'm trying to send telemetry to a device in Azure Iot Central, with HTTP GET requests.
I have a legacy iot application, and I am trying to migrate it to Azure IoT Central, so for now I need to synchronize my ongoing Iot Data to Azure IoT Central.
One way I found to do it quickly was to use Logic Apps.
I have successfully created the Iot Central application and Logic Apps configuration, and I also found a way to get device information and update properties, but I'm not finding where to send telemetry data.
Is it possible to do with Logic Apps, or there is another way to send the telemetry?
Any hints will be very useful, thanks!
you should use the REST POST request to send a telemetry data to the IoT Central App.
The following is an example for device1:
Note, that the iothubhostname must be obtained from DPS service and also the Authorization header (sas token) is required.
and the following screen snippet shows the IoT Central App Dashboard:

Protecting .NET framework 4.x web API with Identity server 4 in

I am working with identity server 4, and I know it is now on ASP.NET Core, and it is fine.
But I have a Web API application that is on .NET 4.6.2. I wonder how is possible to protect these APIs. Or is it possible at all? Or I should change my web API to ASP.NET Core?
I searched everywhere, but all samples are with ASP.NET Core.
Identity Server 4 doesn't care what the client is. You can test ID4 with a console application if you want, right?
You see, when it comes down to it all ID4 is basically is a REST Web API itself with some well known endpoints using the Open ID Connect/oAuth2 protocol on top of the HTTP protocol. Just look at the samples with console clients here to gain more understanding of how you'd like to set up your client: https://github.com/IdentityServer/IdentityServer4.Samples/tree/dev/Clients.
So, that your client happens to be a Web API net462 does not matter. All you have to do is send requests to the urls of a hosted ID4. Maybe look into Katana's Open ID Connect middleware to make things easier for you: https://leastprivilege.com/2014/06/12/using-discovery-and-katana-middleware-to-write-an-openid-connect-web-client/. That is by the way a link to the blog of 1 of the creators of Identity Server. I suggest you browse through his blog to find more usefull information.
Update token validation
For token validation you'd want the token endpoint: http://docs.identityserver.io/en/release/endpoints/token.html. I suggest to read into JWT tokens, because you could for instance look at Katana JWT middleware: http://odetocode.com/blogs/scott/archive/2015/01/15/using-json-web-tokens-with-katana-and-webapi.aspx.

Call Google Glass Mirror API using service account

I need to create a (demo) application for Google Glass with a simple user interaction: insert a card on Glass and get a response back to the application.
I think this can be done by using the Mirror API.
This application is not a web application so I think I need to use a service account.
I have created an API project on the Google APIs console https://code.google.com/apis/console/ and enabled the Google Mirror API.
After that I created a new client ID with application type "service account" (calls Google APIs on behalf of your application instead of an end-user; more info at https://developers.google.com/accounts/docs/OAuth2#serviceaccount).
The result is a client id, email address and public key fingerprint and a P12 key with password.
The problem is that I cannot find an example how to do the service account authentication and for example a card insert.
Any ideas? The used programming language is less important...
See also Can I use OAUTH2 Service Accounts with Glass Mirror API? but unfortunately without an answer.
Edit:
From the answer below I understand I cannot use the service account for this.
Is it then correct that I always need a web application where Google Glass has a callback url so data can be send from Glass to the application?
We develop a Warehouse Management System where the operator in the warehouse uses a voice client (like http://www.epf-gmbh.de/bilderorg/talkman_joe.jpg) that communicates with the server. The server sends commands to the client and the operator can send voice commands back to the server.
For demo purposes I would like to replace the voice client with Google Glass.
Edit 2:
Something like this: http://youtu.be/kbcskj4yAvo
You cannot do timeline operations with a service account. Most Mirror API operations (on the Timeline, Contacts, and Subscriptions) require a user's account since these operations must be done on behalf of the user in order to correctly identify which Glass will be used.
Update:
Your followup questions don't exactly relate to the authentication question, and they may be better asked in a new question, but two quick points:
Yes, when working with the Mirror API if you want to get information from Glass into your server you'll need a webapp which can take callbacks. You'll be registering this as part of a Subscription.
The example you pointed at uses the GDK, not the Mirror API.

Resources