Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Help with state change

Help with state change

Plan

Premium

Country
US

 

Device

pixel 7 pro

Operating System

Android 14

 

My Question or Issue

I am trying to create an API using either Autoweb, or an https put, to change the state to Repeat All. I have been unable to get it to work and I am hoping someone can help me.

Reply
13 Replies

Hi spookiekabuki,

 

It sounds like you're working on creating an API with either AutoWeb or an HTTPS PUT request to change the repeat mode. Could you share what youโ€™ve tried so far? Iโ€™d love to help you figure out whatโ€™s going wrong and get it working smoothly.

 

To change the repeat mode for a user's playback, you can use the Set Repeat Mode endpoint. Just a heads-upโ€”this API is available only for Spotify Premium users.

 

Here's how the different repeat modes work:

  • track: Repeats the current track, perfect for when you just canโ€™t get enough of that one song.
  • context: Repeats the entire playlist or album, great for when you want to keep the vibe going.
  • off: Turns repeat off, so the music flows without looping.

 

Let me know where youโ€™re at with your setup, and weโ€™ll work through it together to get your repeat mode set just the way you want it.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Full disclosure, I do not know what I'm doing. How familiar with Autoweb are you? I can send a set-up screenshot or I can try to tack state onto an existing call like a get info call, but I do not know what components I need to make it work.

HTTPS PUT might just be easier if all I need to do is craft the proper URL?


Hi spookiekabuki,

 

I used the Brows Web Services function to add the Spotify API.

After that, I went to Your Web Services โ†’ Spotify โ†’ the + next to API Actions.

I choose for the offered help, and filled in https://api.spotify.com/v1/me/player/repeat?state=context as the URL. Then I said yes to the question if state was a variable, and if context was a value. Lastly, I choose for PUT. (I've condensed the steps a bit to keep this brief.)

 This worked for me anyway.

 

Let me know where you're getting stuck!

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Ok this is getting me close. I followed your steps and it was identical except for the following:
Went to Spotify> + > Yes for help > Pasted that URL > 

The the variable questions
v1? > no
me > no
player > no

repeat > no
state > yes > default value = context 

Then on to the rest: Name = 'State=context'
Desc = "Change state to context'
Type > PUT


Test and generate output > Yes
Press check mark

I get the attached screen with a small toast error at the bottom and ion the list of APIs, State is listed as "Not yet tested..."

Ive also attached what happens when I try to run it the AutoWeb API in Tasker. It's the same/similar error as in the toast. 

photo_2024-08-20_14-45-07.jpg
photo_2024-08-20_14-45-04.jpg
photo_2024-08-20_14-45-10.jpg

Oh hmm second update: I think it's changing the state, and it might just be the outputs that are throwing an error.

Yes, at my first try, it also gave me an error. Good to see it works for you also ๐Ÿ˜Š

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Do you know what's causing the error?

Also, Can you help me walk through how to GET state. The ideal workflow is to pull state and if <> context, change it. I would run this during specific scenarios, where Player=Spotify and Headphones=Connected. The scenario isn't important though, just the GET api

I think the error is caused by the API isn't detecting that a player is active.

 

I don't know how to detect if the player is Spotify, but I have found out how you can detect which bluetooth device is connected:

  1. Connect your bluetooth device
  2. In Tasker, go to the "Profiles" tab
  3. Choose for "State"
  4. Filter on "BT Connected" and tap it
  5. Next to "Address" tap the magnifying ๐Ÿ” glass
  6. Select your BT device
  7. Hit the back arrow at the top
  8. Make a new task, or connect a already made one

I hope this helps you further.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Oh for tasker, I'm all set. Thanks!

Do you know how to set up the autoweb API to pull the repeat or shuffle state? 

It's documented at this page: Get Playback State

So, with a GET request to 

https://api.spotify.com/v1/me/player?market=US

(You have to change the market to your own at the last step of the setup proces or afterwards. Changing it in the URL directly doesn't work.)

After you've set up the API action for that endpoint, you'll can add an API Output.

Here are my inputs:

  • Tasker Variable: shuffle_state_spotify
  • Name: Shuffle State Spotify
  • Result Type: body
  • JSON path: shuffle_state

You can add another API Output for repeat_state.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

Thanks. IDK what I'm doing wrong but I didn't get it to return true or
false for shuffle state, and it didn't error either

As an alternative, you can long press the Spotify Playback State API Action, then select Generate Output. Then tap the checkmark at the top. Deselect any values you don't need, and tap OK.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.

I still can't get the one output I care about, which in this test if the
shuffle state

Suggested posts

Let's introduce ourselves!

Hey there you, ย  Yeah, you!ย 😁 ย  Welcome - we're glad you joined the Spotify Community! ย  While you here, let's have a fun game and getโ€ฆ

ModeratorStaff / Moderator/ 4 years ago  in Social & Random