API Support

patmadiganpatmadigan Member Posts: 11

We are evaluating Lightspeed Retail for use in a few of our stores. I am a developer who has been tasked with integrating our numerous applications (all .Net based) with the Lightspeed API.

I have reached out to Lightspeed Retail support via phone and chat, and they insist that there is no way for me to contact somebody in API Support about this, short of posting something on this forum.

We want to use the Lightspeed Retail API with our custom e-commerce system, for updating items, prices, and quantities, for managing suppliers, posting transactions such as sales and store transfers, sharing customers, fulfilling web orders from a store, and much more. We are currently doing all of this with Microsoft RMS using our custom integration.

Our e-commerce system is running in .Net as several applications on Windows servers, and in a Windows based application, so none of this is web based. Some things about the Lightspeed Retail API, like the requirement to use a temporary access Token from each application and each session, don't seem like a good fit for our environment. I would like to speak with somebody at Lightspeed, if that is possible, somebody who has a strong understanding of API integration with other e-commerce system.

thanks,

Pat

8 comments

  • gregaricangregarican Member Posts: 511 

    Welcome! This is the best place to get API support I've found. To get a better idea of the particulars regarding the Lightspeed Retail API, check here --> https://developers.lightspeedhq.com/retail/introduction/introduction/. Hope this helps a little!

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 627 moderator

    Hey @patmadigan,

    Please refer to the discussion on the following thread: https://community.lightspeedhq.com/en/discussion/2197/obtaining-access-token#latest

    I have a comment dated July 16 explaining the purpose of the authentication workflow.

    In summary:

    The generation of the temporary token is a one time flow for each account.

    A user with sufficient privileges authenticates your app (as you would when installing an app on your mobile or computer) and then a POST request is send to your callback URL.

    That call back URL can be an endpoint in your app designed to ingest that temporary token and generate the access token. That access token will need to be refreshed every 30 mins using the refresh token endpoint.

    As aforementioned, that is explained in our documentation here:


    Prices, items and quantities can be updated via the Item endpoint here:


    The Sale & Customer endpoint with the relevant request methods examples can be found here: https://developers.lightspeedhq.com/retail/endpoints/Customer/


    Hope this helps!

    Adrian Samuel

    Software Developer - Strategic Solutions

    Lightspeed HQ

  • patmadiganpatmadigan Member Posts: 11

    Thanks very much to Gregarican and Adrian Samuel for your quick replies. I had read through a lot of the documentation, but I had missed a significant point. It appeared to me that we needed some kind of web app to make this work.

    I believe that we can do all of this (refreshing the access token) from our web client in the applications, we don't need web browsers or web applications. I wasn't understanding what the documentation meant by redirect URL's. It's basically just a string, returned to the web client (hopefully), with the new access code at the end of it.

    thanks,

    Pat

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 627 moderator

    Hey @patmadigan,

    Well an API client is needed to send the refresh token request, you'll also be handling rate limiting and you'll be sending data into Lightspeed and request data using Lightspeed. All this is essentially different parts of a given application.

    The access_token is sent as a string in a JSON/XML format.

    Adrian Samuel

    Software Developer - Strategic Solutions

    Lightspeed HQ

  • patmadiganpatmadigan Member Posts: 11

    Adrian, you said:

    "The generation of the temporary token is a one time flow for each account"

    It sounds like you're saying that the temporary token does not expire. But the documentation says:

    "The temporary token is used to request an access token. It expires after 30 seconds, so the access token request must be sent quickly."


    Which is true? That I need to hurry up and use the temporary token to try and get the access token before the 30 seconds is up, or that it's going to last forever and I can rerun my test with the same temporary token?


    I am struggling to get the access token via my application codem and getting "400 bad request". So I would like to know if I need to recreate the temporary token every time I run this test.


    thanks,

    Pat

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 627 moderator
    edited August 2019

    Hey @patmadigan,

    The temporary token does have a 30 second lifespan but you only need to generate it once as it's one of the necessary parameters to acquire an access token. Once you have an access token, a temporary token for that given account is useless and can be discarded.

    You should concerned about managing the access token with the refresh token endpoint.

    If you are unable to obtain your access token within 30 seconds of generating the temporary token then you will need to generate that temporary token again, and continuously until you obtain that access_token and refresh_token.


    To generate that access_token send a POST request to:

     https://cloud.lightspeedapp.com/oauth/access_token.php
    

    Your JSON body should be structured as so:

    {

    client_id:*FILL IN*

    client_secret:*FILL IN*

    code: {temporaryCode}

    grant_type:authorization_code

    }

    If you are still having problems, I'd be happy to look at your request if you could send it below, whilst omitting sensitive data.

    Adrian Samuel

    Software Developer - Strategic Solutions

    Lightspeed HQ

  • Adrian SamuelAdrian Samuel Moderator, Lightspeed Staff Posts: 627 moderator

    Great to hear @patmadigan!

    Adrian Samuel

    Software Developer - Strategic Solutions

    Lightspeed HQ

Sign In or Register to comment.