This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Spotify API
#2
Go to https://developer.spotify.com/console/ and get your token. Make sure that you have enabled all scopes that you want to use via API.

Set volume example. You also need device id which can be found here: https://developer.spotify.com/console/ge...e-devices/
Code:
http = require('socket.http')
ltn12 = require('ltn12')
json = require('json')

access_token = 'abcdef'
devid = 'abdec'
volume = 40
url = 'https://api.spotify.com/v1/me/player/volume?volume_percent=' .. volume .. '&device_id=' .. devid

res, code, headers = http.request({
  url = url,
  method = 'PUT',
  headers = {
    ['Authorization'] = 'Bearer ' .. access_token,
    ['Content-Length'] = 0
  }
})

log(res, code, headers)
Reply


Messages In This Thread
Spotify API - by FatMax - 16.06.2022, 08:14
RE: Spotify API - by admin - 16.06.2022, 08:58
RE: Spotify API - by FatMax - 16.06.2022, 10:50

Forum Jump: