How can I get user-shared location with REST api using Glympse? - rest

I am trying to integrate Glympse into my application using their REST api. But I can not get user-shared location in a card from api /v2/tickets/{ticketID} with the ticketID I got from card member info. It always return invalid ticket ID.
I noticed there is a HTTPS push API. Is it true that user-shared location only can be got by HTTPS push API? Is it possible to get it by normal rest API?

It sounds like you know how to get to the invite code from a card, but I'll still include some of those steps in case it helps others.
This is how to get the user's list of cards.
Doc: https://developer.glympse.com/docs/core/api/reference/cards/get
Endpoint: https://api.glympse.com/v2/cards
This is how to get the details about a single card. You can also optionally pass "members=true" and/or "invites=true" to this call to get added details.
Doc: https://developer.glympse.com/docs/core/api/reference/cards/id/get
Endpoint: https://api.glympse.com/v2/cards/{cardId}?members=true
This is how to get a member of a card. The last ticket that was shared to the card will be found in the member's invite_code value.
Doc: https://developer.glympse.com/docs/core/api/reference/cards/id/members/mid/get
Endpoint: https://api.glympse.com/v2/cards/{cardId}/members/{memberId}
This is how to get the location data associated with a ticket invite code.
Endpoint: https://api.glympse.com/v2/invites/{inviteCode}?next={x}
The 'next' value is used to get just the location updates since the last call. When first querying an invite code, 'next' should be set to 0. For future calls on the same invite code, you should pass the 'next' value found in the previous call's result.
The location data is returned as a JSON array of delta values. More info on delta encoding here...
Doc: https://developer.glympse.com/docs/core/api/reference/tickets/id/append_location/post

Related

Deprecation notice: Obsolete Place IDs

I am setting up the plugin WP Google Review Slider, never thought it was so difficult!
I am getting error:
Deprecation notice: Obsolete Place IDs
and I cannot find where to refresh or update the place ID.
In WP dashword within the plugin I added the API key and I have to add as well the place id, when I do I gett this error message:
Google API Error: Wrong Key or Maps API not added. Due to recent changes by Google you must now add the Maps API to your existing API key in order to use the Location Lookup feature of the Google Places Widget.
View documentation here
and when I go to https://developers.google.com/maps/documentation/places/web-service/place-id, in order to get the place id I get this one: "Deprecation notice: Obsolete Place IDs" and there is no way who to find how to solve it.
Refresh the place id via:
GET https://maps.googleapis.com/maps/api/place/details/output?place_id=<your_place_id>?fields=place_id
From the docs:
We recommend refreshing place IDs if they are more than 12 months old. You can refresh Place IDs free of charge, by making a Place Details request, specifying only the place_id field in the fields parameter. This will trigger the Places Details - ID Refresh SKU. However, this request might also return NOT_FOUND status code. One strategy is to store the original request that returned each place ID. If a place ID becomes invalid, you can re-issue that request to get fresh results. These results may or may not include the original place. The request is chargeable.
Strategy
Call the Place details API to check if the place id is valid
https://maps.googleapis.com/maps/api/place/details/json?place_id=ChIJDx2VxLa1j4AR--kx601BUbY&fields=place_id&key=AIzaSyBiTgTvug0-W1RSaAZOT7cI4NgwzaRHVHc
(change "fields=place_id" to "field=" to see all fields)
It can result in following
Current google place id
Updated google place id
INVALID_REQUEST - (status code indicates that the specified place ID
is not valid)
NOT_FOUND - (status code indicates that the specified place ID is
obsolete. Id is obsolete if a business closes or moves to a new
location) (in this case lat long may not be useful if a business
moves to another location)
Handling the above conditions
Do not do anything (in the future may check also the last time data
is updated in DB to avoid frequent API calls)
Update the google place id inside DB and continue with the open map
Request the google details API with lat long to get a valid google
place id
Request the google details API with a place name to get a valid
google place id

Provide array of URNs to LinkedIn REST API?

I am using the LinkedIn Marketing Development Platform where I am trying to provide a list of company URNs to to the Ad Analytics API. However, when I try to provide a list of company URNs, it fails with status 400.
Analytics Finder endpoint docs
My request:
GET https://api.linkedin.com/v2/adAnalyticsV2?q=analytics&pivot=CAMPAIGN&dateRange.start.day=1&dateRange.start.month=1&dateRange.start.year=2017&timeGranularity=ALL&companies=urn:li:organization:1234,urn:li:organization:5678
Response:
{"message":"Array parameter 'companies' value 'urn:li:organization:1234,urn:li:organization:5678' is invalid. Reason: Deserializing output 'urn:li:organization:1234,urn:li:organization:5678' failed","status":400}
I have also tried URL encoding the URL, and providing the list via the parameter companies[0] as is done in other examples in the docs.
What is the correct way to input arrays to the LinkedIn API?
Edit: Changed accounts to companies
So the Protocol Version actually gave me some useful insight. There are a couple of ways of providing arrays in parameters.
From the docs:
For Restli V1.0 (used by default)
GET GET https://api.linkedin.com/people?ids=1&ids=2&ids=3
For Restli V2.0, which you can use by setting the following header: X-RestLi-Protocol-Version: 2.0.0
Pass parameters in List format.
GET https://api.linkedin.com/v2/people?ids=List(1,2,3,4)
However, I have not managed to get the Analytics Finder API to work with Restli V2.0.
You'll need to provide the list of URL encoded organization URNs to the accounts param. Using your request as an example:
&accounts=List(urn%3Ali%3Aorganization%3A1234,urn%3Ali%3Aorganization%3A5678)

Google Calendar REST API does not return title and other event fields

Google calendar REST API GET method (https://developers.google.com/calendar/v3/reference/events/get) should return this structure (https://developers.google.com/calendar/v3/reference/events#resource), unless I'm missing something.
I need to get event title and description to use in my application. I 'm getting below response instead.
I've tried to change event visibility (public/private) and availability (free/busy). Actually, API does not show events with Free availability, for which I don't have solution either.
Here is event edit screen screenshot:
https://www.screencast.com/t/X8bRS8kJDT
{
"kind":"calendar#event",
"etag":"\"3145149995624000\"",
"id":"5fnlvcl2msab46p8roqbahhb6g",
"status":"confirmed",
"htmlLink":"https://www.google.com/calendar/event?eid=NWZubHZjbDJtc2FiNDZwOHJvcWJhaGhiNmcgZWQtYWRtaW4uY29tXzMwOHNycjdzdjdiM28xazRpdjZ2cm9mb3Y0QGc",
"updated":"2019-11-01T02:23:17.812Z",
"start":{
"dateTime":"2019-11-11T09:30:00+11:00"
},
"end":{
"dateTime":"2019-11-11T10:00:00+11:00"
},
"visibility":"private",
"iCalUID":"5fnlvcl2msab46p8roqbahhb6g#google.com"
}
Are there other methods to get calendar events details with REST API, including ones with free availability?
Thanks.
04/02/2020:
I actually made it work for "ordinary" Google account - add project, add API, add service account and allocate service account email to the calendar. But I still not sure how to change access level for G Suite account. It allows only to see Free/Busy status.
I've changed default access in Admin Console as this article suggests, but it does not help:
https://www.macworld.com/article/2980005/the-mystery-of-the-unsharable-google-apps-calendar.html
You could try specifying the fields you want to retrieve like the image below:
Or you could put a " * " as the image below to retrieve all values:
fields is a standard Query parameter, which specifies what values you want to include in your response. To learn more about it, you can check Here.

How to get the actual drop location(not the destination) of a Uber Ride via API, after the ride completes?

I can see the my actual drop location on the receipts page on riders.uber.com, but do not see that data in requests/{request_id}/receipt/ end point of the API. Is there an alternative to get this data ?
I see that a GET on requests/{request_id}/ gives the actual location of the a ride, but does this point also gives the same data on ride completion/cancellation ? On sandbox-api, on completion of ride, I get location as null, on a GET requests/{request_id}/ call
The Uber API doesn't expose this information. It provides the destination of a trip in the request details, but it does not update the destination based on the actual drop-off location.
As pointed out in the comments, ONE partial alternative for this use case might be to use the request details array of waypoints. However, it is only available for shared rides like UberPOOL.

Salesforce API CALL issue

I'm testing the REST API,
I successfully called to https://naxx.salesforce.com/services/data/v29.0/sobjects/
It returns the expected result.
When I call to https://naxx.salesforce.com/services/data/v29.0/sobjects/Account/
It returns a (404) Not Found response.
I have replaced the "Account" placeholder with the logged user's email, nickname, email , also I have tried with access_token.id value but nothing works. The answer is always 404.
What should I use as "Account" value, and where can I get that information?
I'm following this documentation:
http://www.salesforce.com/us/developer/docs/api_rest/index_Left.htm#CSHID=quickstart_oauth.htm|StartTopic=Content%2Fquickstart_oauth.htm|SkinName=webhelp
Specifically the subtitle called "Get Basic Object Information".
I have the same problem with:
https://naxx.salesforce.com/services/data/v29.0/sobjects/Account/describe/
https://naxx.salesforce.com/services/data/v29.0/query?q=SELECT+name+from+Account
I have not the problem with:
https://naxx.salesforce.com/services/data/
https://naxx.salesforce.com/services/data/v29.0/
https://naxx.salesforce.com/services/data/v29.0/sobjects/
Thank you in advance.
Account is not placeholder text it is the actual name of an SObject type. That it returns a 404 response means your user account does not have access to Account records. You should check your users profile & license settings. The services/data/v29.0/sobjects/ request will return details of all the SObject types your user has access to. (so you'll find that Account is not in this list in your case)
I had a similar issue. I was able to access the object Account in the list of objects but was not able to retrieve the metadata. Seems that the documentation misses the parameter "sobjects" in the path. The correct URL is:
https://na1.salesforce.com/services/data/v20.0/sobjects/Account/describe/ -H "Authorization: Bearer token"
This can be confirmed through by trying the url:
https://na1.salesforce.com/services/data/v20.0/sobjects/Account
which lists the uses such as records, describe, listviews, etc. It may vary based on organization and if the user has permission, it is ideal that the developer hit the second URL and then obtain the correct base url to retrieve the metadata.