Setmore Booking App API

Setmore Booking App API
0.0 0

#1

Hi. Hopefully someone can point out how to go about this. I am trying to access info from the Setmore API. I am trying to construct a mobile web app for my wife’s day spa and would like to integrate the API calls into her website. I haven’t gotten far with this.

So far I have been able to use Postman to make a GET request for a token using their supplied refresh_token. Then I was able to make a successful GET request on the Bookingservices api.

Now I would like to know how do I go about using this in an actual Express web app. I’ve tried looking online for references but all the info given to me is a bit over my head at the moment. Does anyone know of a tutorial or link that would help explain Token based API’s in a simpler way?


#2

Firstly, welcome to the forums.

While we are primarily here to help people with their Free Code Camp progress, we are open to people on other paths, too. Some of what you are asking is pretty trivial in the Free Code Camp context, so you might find that if you’re not getting the instruction and material you need in your current studies, the FCC curriculum will really help you get started. At a modest guess I’d say investing a 4-5 hours working through the curriculum here will really pay off. You can find the curriculum at https://freecodecamp.org.

With your current questions, we don’t have enough context to know what you already know or don’t know, so it is impossible to guide you without just telling you the answer (which we won’t do).

It is pretty typical on here for people to share a codepen / jsfiddle example of what they have tried so that anyone helping has more of an idea of what help is actually helpful.

Please provide some example of what you’ve tried and I’m sure you’ll get more help.

Happy coding :slight_smile:


#3

Hi for making rest call in the express app you can make use of node module called “request”

The code for making setmopre api call will look like this

  request.get(
    { 
        url     :'https://my.setmore.com/api/v1/bookingpage/services',
        headers : { 
                    'Content-Type': 'application/json',
                    'Authorization': 'Bearer <CHANGE_TO_ACCESS_TOKEN_GIVEN_BY_SETMORE>' 
                  },
    },
    (error, response, body) => {
            console.log('error:', error); // Print the error if one occurred
            console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received
            console.log('body:', body); // Print the RESPONSE JSON for the SETMORE homepage.
            
    });

And there is one more module call’s node-fetch its work with concepts of promise
Just made an example of it Using some async await concept it sort of code clean look…

I am creating the tutorial+ sample express project with Setmore API
will post you once it is done…

Happy Learning!!