I am unable to access the Driver behavior service API's through any means like from node js, python, and by postman also - ibm-cloud

I am using one API to get the car probe data by date. This is the API
get method: https://api.ibm.com/driverinsights/datastore/carProbe/dateList?tenant_id=1ce29c2a-d408-4551-b1fd-815cf5810a02
Headers:
accept:application/json
content-type:application/json
Authorization:Basic NEZwMkd5bVc6cEdddHVqc1c1eVJaQVA=
I am getting response as
{
"httpCode": "404",
"httpMessage": "Not Found",
"moreInformation": "The requested URL was not found on this server"
}

the error message on your side says "404 Not Found".
Please check your hostname in the URL of Driver Behavior service.
[Correct]
"https://automotive.internetofthings.ibmcloud.com/driverinsights"
[Incorrect (yours)]
"https://api.ibm.com/driverinsights"
Please refer to official API documentation.
https://developer.ibm.com/api/view/id-261:title-IBM_Watson_IoT_Driver_Behavior#doc

Related

Google API Client Error: the caller does not have permission

I'm trying to use the Google API Client to gain access to a Google Doc. I get the following error:
googleapiclient.errors.HttpError: <HttpError 403 when requesting https://docs.googleapis.com/v1/documents/1Dc82X_w8UsyZnJe5JEh4E0wNdfbw-_nhVWXwgEJ4HVg?alt=json returned "The caller does not have permission". Details: "The caller does not have permission">
The error comes up in the file extract_text.py, which I got from here: https://developers.google.com/docs/api/samples/extract-text
Specifically, the error shows up at this line when it's obtaining the document's ID:
doc = docs_service.documents().get(documentId=documentID).execute()
The error states that my request has invalid authentication credentials (https://cloud.google.com/asset-inventory/docs/faq). I have made sure that I setup the OAuth correctly.

"Access is denied due to invalid credentials" REST API error. How to solve?

I followed the documentation here: and here: Trying to integrate to a Personality Insights service via Android Java.
However, after the app runs, and using the correct username and password as mentioned in the guide... (the guide is not clear (2nd bullet point in "Before you begin") on which set of credentials to use - It says get the "service credentials" and credentials from the new service created - I tried with both and both fail with the same error below.)
Error:
12-11 01:49:56.201 29584-29632/? I/CredentialUtils: JNDI string lookups is not available. 12-11 01:49:56.269 29584-29632/? D/NetworkSecurityConfig: No Network Security Config specified, using platform default 12-11 01:49:56.723 29584-29632/? D/OkHttp: --> POST https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13 http/1.1 (1297-byte body) 12-11 01:49:56.803 29584-29632/? D/OkHttp: <-- 401 Not Authorized https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13 (78ms, unknown-length body) 12-11 01:49:56.863 29584-29632/? E/WatsonService: POST https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13, status: 401, error: Not Authorized 12-11 01:49:56.865 29584-29632/? E/ERROR: Unauthorized: Access is denied due to invalid credentials
com.ibm.watson.developer_cloud.service.exception.UnauthorizedException: Unauthorized: Access is denied due to invalid credentials at com.ibm.watson.developer_cloud.service.WatsonService.processServiceCall(WatsonService.java:492) at com.ibm.watson.developer_cloud.service.WatsonService$2.execute(WatsonService.java:254) at com.upen.personalityapp.MainActivity$RetrieveFeedTask.doInBackground(MainActivity.java:105) at com.upen.personalityapp.MainActivity$RetrieveFeedTask.doInBackground(MainActivity.java:87) at android.os.AsyncTask$2.call(AsyncTask.java:306) at java.util.concurrent.FutureTask.run(FutureTask.java:237) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:244) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607) at java.lang.Thread.run(Thread.java:761) 12-11 01:49:56.866 29584-29584/?
This is the code I am using; I am trying to pass a "text" input to the service.
service = new PersonalityInsights("2017-10-13");
service.setUsernameAndPassword("{myUsername}", "{myPassword}");
Profile profile = service.getProfile(text).execute();
System.out.println(profile);
return profile.toString();
I am using the com.ibm.watson.developer_cloud:personality-insights:3.8.0 dependency.
I tried connecting to the URL in the error (https://gateway.watsonplatform.net/personality-insights/api/v3/profile?version=2017-10-13 ) via a browser. It prompts for a username/password combo. I entered my details from my IBM Cloud Lite service but it throws the HTTP Error 405. Is this how it's supposed to work on the browser?
For someone in the future;
Instead of service.setUsernameAndPassword(username, password);, I tried service.setUsernameAndPassword("username", "password"); and it worked.

How to share file with room in HipChat via Postman or Jersey client?

Please provide the solution for this (I am new to jersey and postman). I tried with below link but unable to share the file: https://www.hipchat.com/docs/apiv2/method/share_file_with_room
I attached screen shots, which I tried from postman.
Note: I used API access token with send message scope.
I am getting below error as response:
{
"error": {
"code": 400,
"message": "No file was found in the request. See https://www.hipchat.com/docs/apiv2/method/share_file_with_room for an example",
"type": "Bad Request"
}
}

"unsupported URL" error given when accessing api gateway endpoint from swift

I have the following code that is trying to invoke and api gateway function called endsession in swift:
client.endsessionPost(body: pleasegod!).continue ({ (task:AWSTask) -> Any? in
if let error = task.error {
print("Error occurred: \(error)")
return nil
}
if let result = task.result {
print("IT WORKED")
// Do something with result
}
return nil
})
It runs and completes but task error occurs and the print statement of what the error is says:
Error occurred: Error Domain=NSURLErrorDomain Code=-1002 "unsupported URL" UserInfo={NSUnderlyingError=0x618000056e60 {Error Domain=kCFErrorDomainCFNetwork Code=-1002 "(null)"}, NSErrorFailingURLStringKey=(null)/endsession, NSErrorFailingURLKey=(null)/endsession, NSLocalizedDescription=unsupported URL}
It seems to be saying the endpoint url provided is bad. The endpoint url was just copied and pasted from the endpoint of the api gateway deployment so I am not sure why that would be an unsupported url.
The endpoint has a format like so:
https://kco37e2fsa.execute-api.us-west-1.amazonaws.com/TheStage
When I visit this endpoint in a browser I notice it says:
{"message":"Missing Authentication Token"}
Which is strange since both my api gateway resources have Authorization set to None and API Key set to not required on all their methods. Is this missing authentication token a clue as to why I am getting unsupported URL errors in swift when invoking the API??
The url https://xxxxxxxxxx.execute-api.us-west-1.amazonaws.com/TheStage will only work if you have a GET method configured on the root resource, and if that is deployed to a stage called TheStage. (No sure if the API Id and/or stage are real). A browser will send a GET request if you just navigate to the URL.
I would recommend a tool like Postman for testing API calls; you can configure parameters, body, HTTP method, auth, etc.

How to debug Alexa flash briefing skills? Not available error

I am building a flash briefing skill for Alexa. I am using JSON, the JSON feed seems to be working well, went over the checklist and everything checks but when enabling the skill and starting my flash briefing I only get the "Custom Error Message" I have specified in the flash briefing skill definition, with no errors in the CloudWatch logs or anywhere else. No error when checking the feed elsewhere.
I am using AWS API gateway without authentication and the Content-Type is properly set to application/json and I double checked the response with JSONlint.
This is the URL for the feed:
https://l7kjk6dx49.execute-api.us-east-1.amazonaws.com/prod/postedmessage/feed
Following the suggestion of #Bob I updated the feed URL and enabled logging. The feed is called properly from my browser and there seems to be a call when trying to open the flash briefing and the response is OK, from Cloudwatch logs:
2016-11-19
16:15:34
Starting execution for request: 66ac03af-ae73-11e6-8719-1d2a8a213089
16:15:34
HTTP Method: GET, Resource Path: /postedmessage/feed
16:15:35
Successfully completed execution
16:15:35
Method completed with status: 200