[GH-ISSUE #111] Urlencode user id's in POST/PUT requests #65

Closed
opened 2026-02-27 19:25:52 +03:00 by kerem · 2 comments
Owner

Originally created by @PouleR on GitHub (Dec 20, 2017).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/111

When using a POST or PUT request to Spotify with a username like '#username' the request fails:

POST https://api.spotify.com/v1/users/#username/playlists` resulted in a `404 Not Found

When the user id is url encoded the request succeeds. It's difficult to test since you need to have access to an account that has this kind of username (in this case that starts with a '#').

A possible solution could be to always urlencode the userId in post/put requests, since I haven't noticed this behaviour with GET requests.

Originally created by @PouleR on GitHub (Dec 20, 2017). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/111 When using a POST or PUT request to Spotify with a username like '#username' the request fails: ``POST https://api.spotify.com/v1/users/#username/playlists` resulted in a `404 Not Found`` When the user id is url encoded the request succeeds. It's difficult to test since you need to have access to an account that has this kind of username (in this case that starts with a '#'). A possible solution could be to always urlencode the userId in post/put requests, since I haven't noticed this behaviour with GET requests.
kerem closed this issue 2026-02-27 19:25:52 +03:00
Author
Owner

@jwilsson commented on GitHub (Dec 20, 2017):

Hi!
Thanks for the report.

It's pretty strange, though. I just created a test account with a "#" in the name, and I get a 404 when I try to use a POST endpoint without URL encoding it. But when I try to URL encode it, I get a 403 response with the message You cannot create a playlist for another user.

I'm gonna file an issue with Spotify and see what they say about it. If the solution is for us to URL encode it on our end, I'm totally fine with that.

<!-- gh-comment-id:353171298 --> @jwilsson commented on GitHub (Dec 20, 2017): Hi! Thanks for the report. It's pretty strange, though. I just created a test account with a "#" in the name, and I get a `404` when I try to use a POST endpoint without URL encoding it. But when I try to URL encode it, I get a `403` response with the message `You cannot create a playlist for another user`. I'm gonna file an issue with Spotify and see what they say about it. If the solution is for us to URL encode it on our end, I'm totally fine with that.
Author
Owner

@jwilsson commented on GitHub (Sep 22, 2018):

Hi again!
This seems to be fixed on Spotify's end, so I'm gonna close this.

Just give me a shout if further work is needed!

<!-- gh-comment-id:423750067 --> @jwilsson commented on GitHub (Sep 22, 2018): Hi again! This seems to be fixed on Spotify's end, so I'm gonna close this. Just give me a shout if further work is needed!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-web-api-php#65
No description provided.