0

Spotify API Request

Hi to all

Has anyone attempted to connect to Spotify through an API Request?

 

let token := "BQB7FiB1M60v_z...VlaJOMjdE1-I";
let artistId := "0TnOYISbd1XYRBk9myaseg";
let response := http("GET", "https://api.spotify.com/v1/artists/" + artistId + "/albums", {
Authorization: "Bearer " + token,
'Content-Type': "application/json"
});
if response.status_code = 200 then
let albums := response.body.items;
AlbumsID := albums
else
AlbumsID := "Errore nella richiesta: " + response.status_code + ", Risposta: " + response.body


i am getting no response...

thank you for attention

5 replies

null
    • Ninox partner
    • RoSoft_Steven.1
    • 3 wk ago
    • Reported - view

    you need to write "do as server":

    let response := do as server
    http("GET", "https://api.spotify.com/v1/artists/" + artistId + "/albums", {
    Authorization: "Bearer " + token,
    'Content-Type': "application/json"
    });
    if response.status_code = 200 then
    let albums := response.body.items;
    end;
      • francescostefanello
      • 3 wk ago
      • Reported - view

       if i write "do as server" I can not include the line 

      if response.status_code = 200 then  

      inside of it

      • Ninox partner
      • RoSoft_Steven.1
      • 3 wk ago
      • Reported - view

      see this example, sorry, change it to this... https://docs.ninox.com/en/api/http-function#example

      • francescostefanello
      • 3 wk ago
      • Reported - view

        i can not resolve this, the endpoints are right, i have tested them with postman, but for an obscure reason i can not solve it. But the information you gave to me (do as server) is new for me. Thank you for this

      • Ninox partner
      • RoSoft_Steven.1
      • 3 wk ago
      • Reported - view

      To help you debug, you can open the console of the browser and see if you have errors there. If you have CORS errors, it's certainly because you need to use "do as server".

Content aside

  • 3 wk agoLast active
  • 5Replies
  • 34Views
  • 2 Following