HERE API - Places data - Save/Cache - here-api

Can I save the following information related to a Place?
Place ID; Title of the place and Lattitude and Longitude of the place?
if so, for how long?
and also can you please let us know if can Cache the data? if so, for how long?
I tried Searching the Policies about the above query but no luck.

Cache control information can be found in the header cache-control for APIs. Take a reference from Image API at below reference
https://developer.here.com/documentation/map-image/topics/response-headers.html
Headers :
cache-control: public,max-age=XXX

Related

Google Calendar - SyncToken is missing in API response

I don't see nextSyncToken in the response. I followed the doc(https://developers.google.com/calendar/api/guides/sync) and paginated using nextPageToken but I couldn't see the nextSyncToken on the last page.
API Used: GET /calendars/primary/events?maxResults=10&singleEvents=true&pageToken=********
I don't know whether if I miss anything here. Could anyone help me with this?
I have seen from the response link on the other answer comment that you are using orderBy on the request.
This is why the nextSyncToken is not showing up.
As mentioned on the documentation on Events: list -> Parameters -> syncToken:
Token obtained from the nextSyncToken field returned on the last page of results from the previous list request. It makes the result of this list request contain only entries that have changed since then. All events deleted since the previous list request will always be in the result set and it is not allowed to set showDeleted to False.
There are several query parameters that cannot be specified together with nextSyncToken to ensure consistency of the client state.
These are:
iCalUID
orderBy
privateExtendedProperty
q
sharedExtendedProperty
timeMin
timeMax
updatedMin
If the syncToken expires, the server will respond with a 410 GONE response code and the client should clear its storage and perform a full synchronization without any syncToken.
Learn more about incremental synchronization.
Optional. The default is to return all entries.
You should remove the orderBy from the request to get the syncToken
Could you please provide the response from gcalendar API? It's hard to say more without detail information. I event don't know which language are you using.
Try to use a vendor library to sort that out:
a) https://packagist.org/packages/google/apiclient (for PHP)
b) https://www.npmjs.com/package/google-calendar (for JavaScript)
and/or
Try to use alternative endpoint: GET https://www.googleapis.com/calendar/v3/calendars/calendarId/events.

Linkedin profile image url giving access denied

I have used Spring social for integration with linkedin.
When the integration completes we save the users profile image which has below url:
https://media.licdn.com/dms/image/C5603AQHQ0C7xKhQehg/profile-displayphoto-shrink_100_100/0?e=1527508800&v=alpha&t=vkxX_3Uw7qe8d_9ZSqPwQGpwa6nfUmkzMgEKtMdgf1g
But this url is giving access denied error. Is there something I am missing?
This may help, As per https://developer.linkedin.com/docs/ref/v2/media-migration,
The new id will be dynamic and can change from time to time. We recommend retrieving at least once every 60 days to update your media-typed URN.
This could be one of the issue which you might be facing.
In order to fix this, I save the image, the moment it is received on to personal storage(AWS S3).
I looked at the URL of my picture of my In Public profile and the one returned from the API.
The picture URL in the XML returned after the ? for params v and t had &amp ; instead of &:
e.g.
https://media.licdn.com/.../profile-displayphoto-shrink_200_200/0?e=152800"&amp";v=beta"&amp";t=LJTrw_oj9npH06X1u0HjQ
Replacing it with something like:
pictureURL = pictureURL.replaceAll("&amp ;","&");
fixed the issue for me.
Hope this helps
Note that there is an extra space between &amp and ;. It would have formatted otherwise.

How do I access individual headers from a API request response?

I'm currently creating a test suite for a new API, at the moment I've sent a POST request and it's responding as expected. However, I'm now performing further validation such as checking the status code and also wish to check the Location Header. Problem being, through trial and error I've been unable to access to location header value from the response. Below is some cut down code:
${POST_REQUEST} Replace String ${CLAIM_AVAILABLE_BASE_URL} PLAN_NAME ${VALID_PLAN}
${file_data}= Get Binary File Data/Json/API/GETNaviNetClaimID/valid_aries_claim_local_only.json
${POST_RESPONSE} Post Request APIService ${POST_REQUEST} data=${file_data}
Should Be Equal As Strings ${POST_RESPONSE.status_code} ${HTTP STATUSCODE OK}
I can access the header object using:
${POST_RESPONSE.headers}
But so far I've been unable to pull out just the location header value. Can anyone offer any assistance? I'm using the Requests Library
Seems possible using the below, just replace location with the key you're looking for.
${location_header}= Get From Dictionary ${POST_RESPONSE.headers} location
I don't like this solution though so welcome to anything better!

Google Geocode API "REQUEST_DENIED" in JSON response - reverse geocode action

Looked everywhere — and have read dozens of other questions regarding Google APIs (Maps, Geocode, Places, Autocomplete, etc) — and nothing has worked.
I have an API key with Places, Static Maps, and Maps v3 & v2 services enabled.
I am trying to perform a reverse geocode (get street address information via JSON from lat/long coords).
Here is the URL I am passing in my JavaScript (last 5 digits of API key replaced with #####:
http://maps.googleapis.com/maps/api/geocode/json?latlng=49.8925136,-97.1466635&sensor=true&key=AIzaSyDbfv8bFidX1hSbXwwKTTxWQYgU7g####
The JSON response is:
{
"results" : [],
"status" : "REQUEST_DENIED"
}
As you can see, there is a "sensor=true" parameter being passed - which is the problem according to the Google Document supporting this API, but that is clearly not the case here.
I also tried passing simply
http://maps.googleapis.com/maps/api/geocode/json?latlng=49.8925136,-97.1466635&sensor=true
which returns expected JSON response when the URL is entered into the addressbar of a browser — but when added to the JavaScript in my HTML file, I again receive:
{
"results" : [],
"status" : "REQUEST_DENIED"
}
Any assistance is welcome, and greatly appreciated.
Google don't particularly want you to use this static API in a web page. You should be using the Maps API in a web page, and its associated geocoding functionality (because you need to show the results on a map anyway). These static APIs are intended for use server-side, so it looks like they now refuse requests which come with an HTTP_REFERER header.
(Using the key server-side allows you to keep track of statistics, but an invalid key will always result in REQUEST_DENIED whether there is a referrer header or not.)
I kept struggling with the exact same problem and I believe I came up with a very practical solution, which actually works just fine with me! You just have to make a small modification to your request query's URI.
Instead of querying the
http://maps.googleapis.com/maps/api/geocode/json?latlng=49.8925136,-97.1466635&sensor=true
you should actually query the google maps api using the following URI:
http://maps.google.com/maps/api/geocode/json?latlng=49.8925136,-97.1466635&sensor=true
That small modification did the work for me like a charm!
Hope this helps.

Google Calendar API - can only update event once

I've encountered the same problem as described in this post:
Google Calendar api v3 re-update issue
Namely, once I create an event and update it once using the Google Calendar API (v3), I am no longer able to update the event. When I attempt to, I get a 400 - Invalid value response. (FWIW I'm working in PHP).
Following a lead offered in the post I referenced above, I attempted to solve the issue using etags (though admittedly my grasp of how they work is limited). Basically, on event update, the API returns an etag in its response, which I now save in my database. Then for subsequent (n > 1) updates, I pull the current etag from the database and include it in the http header:
Content-Type: application/json
Authorization: OAuth [token]
If-Match: [etag]
This follows info under the "Updating Entries" header here: http://code.google.com/apis/gdata/docs/2.0/reference.html#ResourceVersioning
Sidenote: in the google ref above, the If-Match header is shown as
If-Match: "S0wCTlpIIip7ImA0X0QI"
with double quotes around the etag. I'm saving the etags in the database with double quotes, exactly as I receive them in first update response. Do I need to escape the quotes or anything when adding to the header using curl_setopt/HTTPHEADER?
Despite implementing this etag If-Match thing, I'm still getting the same 400 - Invalid value response. I know that my request bodies are valid because the first update works fine. There's just some additional issue surrounding subsequent updates.
Any help much appreciated.
Make sure to increment the sequence number field when updating events.
I had same problem. To increment the sequence number you need to keep track of how many updates you have done and include the next increment in your update. For some reason the first update doesn't require this but subsequent updates do require it.
Using the google php library on your 2nd update to the event would look something like this (minus whatever else your are updating):
$calendarID = ID_OF_YOUR_CALENDAR;
$eventID = ID_OF_YOUR_EVENT;
$event = new Google_Event();
$event->setSequence('2');
$calEvent = $cal->events->update($calendarID $eventID, $event);
That is how I do it. Fetch the entry from Google so it already has the latest Etag set and increment the sequence by one and update the entry.
As I use java so following is a example with java:
com.google.api.services.calendar.model.Event googleCalendarEvent = service.events().get(clientCalendarEvent.getCalendar().getCalendarKey(),clientCalendarEvent.getEventKey()).execute();
updateGoogleCalendarEvent(clientCalendarEvent, googleCalendarEvent);
googleCalendarEvent.setSequence(googleCalendarEvent.getSequence() + 1);
com.google.api.services.calendar.model.Event event = service
.events()
.update(clientCalendarEvent.getCalendar().getCalendarKey(), clientCalendarEvent.getEventKey(),
googleCalendarEvent).execute();

Resources