Need help making an API call 🙏
# 🤝help
c
Hey Everyone, I'm in the middle of an exciting new project where I am building out a booking AI chatbot for a property management company. Ideally, I would like to be able to access the API of the channel manager my client is using, which stores a lot of relevant information such as which properties are available, how many bedrooms they have, the price per night, etc. Once I access this data, I would like to be able to return a selection of properties that match the specifications that the prospective guest is looking for. To provide some context, the channel manager they are using is called bookandlink (https://web.bookandlink.com/) and they have already sent over their API documentation in a Google Doc, which you can find here: https://docs.google.com/document/d/1zpyZcFYOwcxxieW2MRs23QCGMTFH9qZe/edit?usp=sharing&ouid=117712504207182812054&rtpof=true&sd=true The main issue here is that I am not a developer and I have no idea what to do with this information. I have tried asking ChatGPT to help me make sense of this, but I'm still quite lost when it comes to actually executing this the way I'm envisioning. Could anyone point me in the right direction of how I can make a call to this API to access information about the properties? Any advice would be immensely appreciated 🙏
a
Hey @creamy-orange-87775, here's an example from the recipe bot showing how it makes an API call:
Copy code
js
const url = 'https://api.spoonacular.com/recipes/complexSearch'
const params = {
  query: workflow.baseQuery,
  diet: workflow.dietType,
  apiKey: env.apiKey,
  number: '3',
  ignorePantry: 'false',
  sort: 'popularity',
  sortDirection: 'asc',
  addRecipeInformation: 'true',
  addRecipeNutrition: 'false'
}

try {
  const response = await axios.get(url, { params })
  if (response.status === 200) {
    workflow.recipeInfo = response.data.results
  }
} catch (error) {
  console.error(error)
}
A few other resources that could help: * https://flaviocopes.com/node-axios/#the-axios-api *

https://youtu.be/W97VzAK7OO4?t=60

* https://zetcode.com/javascript/axios/
c
Hi Gordy. Thank you for showing the building process, it is amazing. I have an error while making Api. The answer is not showing. Additionally I see, that in JSON notes it shows in red: trigger: undefined. Could this be a reason? How to fix it?
a
what is your code and what is the error?
19 Views