How to get RouteId for my getroute request? - here-api

I have Freemium plan on HERE and I'm using routing REST service.
When I request a detailed car route between two way points with a getroute request https://route.api.here.com/routing/7.2/getroute.json?app_id=APPID&app_code=APPCODE&waypoint0=geo!47.4183889,9.7318127&waypoint1=geo!47.4315312,9.8954753&mode=fastest;car;traffic:disabled, I have to set routeId parameter, otherwise I will receive an error "Parameter \"routeid\" is not specified".
How can I get my routeId? I expected I will receive it with a calculateroute results, but it is not in the json response.

Hi getRoute request is used to retrieve more information about a previously calculated route. So, routeId must be available to you as part of your earlier calculateRoute response. For getting the routeId, you must specify routeAttributes to routeId "&routeattributes=ri". Please see the documentation here (routeAttributes) -

Related

Coinbase HTTP Request for Ether Spot Price

I can currently issue the following request: https://api.coinbase.com/v2/prices/spot?currency=USD and receive a json response with the current (spot) price of BitCoin (BTC).
What I want is to retrieve that information for Ether (ETH). I note that the HTTP request that I am using does not specify BTC, it just defaults to that.
I have reviewed the Coinbase API without success in locating an answer.
I was just wondering if anyone is aware of an HTTP request to obtain that data, or if this request is not currently supported via HTTP.
tia
The Coinbase API docs, https://developers.coinbase.com/api/v2#get-spot-price shows the following URI structure for getting the spot price for Bitcoin (BTC) or Ethereum (ETH), which is different from what you have posted.
https://api.coinbase.com/v2/prices/:currency_pair/spot
The part of the url indicated as :currency_pair is a string containing
the symbol for the coin, a hyphen and then 'USD', such as BTC-USD or ETH-USD.
I am able to get BTC and ETH spot prices from the api with the following:
https://api.coinbase.com/v2/prices/BTC-USD/spot
https://api.coinbase.com/v2/prices/ETH-USD/spot

I send some values to another url and about that

I send some values using spring httpClient to other url. And about that question as I know if I send name=mister age=30 values, received page get that values not http status values, right?
Http status values are for sending page's not receive page's.
I mean, if I send those values, receiving page gets http values.
If receiving page want to get that values, I have send that values, is that right?
My team manager said to me that http has request and response so, if you send some values to other url, other url gets http status values.
But as I thought that is little bit anyway I can't understand my team manager's saying, please let me know, receiving page gets http status when I send some values.
Your team manager's statement is correct. ("the http status have to be written.", "http has request and response. so there should have that http status value result"). What he/she mentioned is HTTP response status code, which should be returned (with correct code) whatever the response is.
No matter your result (name=mister and age =30 etc.) is a static page or an Ajax response, the response code should be 200 OK when the result is generated successfully (correct business logic, no error happens). But when something bad happens, it is important to let client know why server failed to return result -- maybe it is because the request format is incorrect (400 Bad Request), there is a typo in request url (404 Not Found) or some error in server code (500 Internal Server Error). Send name=null and age=null to client with 200 OK is incorrect and bug prone. Without definition of these error status code in document, backend engineer have to communicate with frontend engineer during the development, API by API, case by case, which is very time consuming and inefficient.
I think your TODO is: for the API that accepts name=mister and age =30, define success case and different failure case, then assign correct response code to them.

Amending scope values in token request causes problems accessing APIs afterwards

I am encountering the following error after amending a scope value being sent in the headers of a token POST request against the token API endpoint for our WSO2 instance:
ERRORS.900901
Invalid CredentialsAccess failure for API: /scheme/v1, version: v1 with key: fa41109938522762bcca953336f0e0e2.
Make sure your have given the correct access token
This error comes after I successfully get a token returned and then use that token for a an API setup in WSO2 publisher. This particular endpoint in the error does not actually have any scopes applied to it which causes me some confusion about why this error comes up since its not a scope protected endpoint so my token shouldn't matter?
This happened after I realised there was a typo in a scope value I was sending in the POST request and so I updated it accordingly.
If I leave the typo in I can use the token generated for a subsequent API request and dont get this error.
Am I right in thinking that tokens are generated based on the list of scopes returned back by the Token API for the given user?
I have tried manually revoking the access token using a cURL command as documented here and generating a new one using the corrected scope names, but still this error comes back after trying to access that API.
What could be the issue here?
Thanks
This error comes after I successfully get a token returned and then
use that token for a an API setup in WSO2 publisher. This particular
endpoint in the error does not actually have any scopes applied to it
which causes me some confusion about why this error comes up since its
not a scope protected endpoint so my token shouldn't matter?
This also can happen if there were any errors while validating the token. This doesn't look like a scope issue. So if you can provide the corresponding logs in wso2carbon.log, I can tell the exact reason.
Am I right in thinking that tokens are generated based on the list of
scopes returned back by the Token API for the given user?
Yes.

Telend ESB unique message id

I search Talend documentation, but maybe I overlook something. I have route that receive http request and I want to get that request message ID. Maybe it is in some property, but how I can get it? It can't be so difficult than WSO2 or Mule.
You should have a look at the Camel documentation instead :
http://camel.apache.org/simple.html
${id} will give you the ID that Camel has given to the incoming message

Distinguish between no results and and no service in a Restful web service

If I have a service running with a url pattern similar to below.
HOST/animals/{id}
If do a GET on this url with a non existent id for most Rest implementations I would expect to receive a 404 Not Found response.
If I do a GET request for (note the typo!):
HOST/animels/{id}
With a valid id I will also get a 404 response in most Rest implementations.
Obviously I can distinguish between the scenarios by looking in the response body but this would be custom behaviour for my API.
Is there an standard approach to this?
Maybe return method not allowed/bad request for non mapped urls (though this would be large change to expected behaviour)?
Or do we need 2 status codes for Not Found?
A scenario for something like this occurring is a typo in some documentation/implementation of a client.
If you treat the entire URL as an identifier that points to a resource, the two cases are the same.
Case-1: '/animals/{bad-id}'points to a resource that is not found.
Case 2: '/animels/{id}' points to a resource that is not found.
Thus both cases should be treated the same as 'NOT Found'

Resources