Search code examples
restglympse

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


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?


Solution

  • 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