Error on API login #683

Open
opened 2026-10-05 00:11:20 +02:00 by adam · 4 comments
Owner

I try to connect to the API, with the pwg.session.login method, with the HTTP method POSTwith the following url:

https://piwigo.buron.coffee/ws.php?format=json&method=pwg.session.login&username=test&password=test

I got the following error with a 405 HTTP code :

{"stat":"fail","err":405,"message":"This method requires HTTP POST"}

What am I doing wrong ?

I try to connect to the API, with the `pwg.session.login` method, with the HTTP method `POST`with the following url: ``` https://piwigo.buron.coffee/ws.php?format=json&method=pwg.session.login&username=test&password=test ``` I got the following error with a 405 HTTP code : ``` {"stat":"fail","err":405,"message":"This method requires HTTP POST"} ``` What am I doing wrong ? <!-- github-sync-id:245248881 -->
Author
Owner

Hi @emixam150

You passed the argument in GET. Keep only {format, method} in GET but move {username, password} in POST.

Hi @emixam150 You passed the argument in GET. Keep only {format, method} in GET but move {username, password} in POST. <!-- github-comment-id:317688812 -->
Author
Owner

Actually I already test to post this :
https://piwigo.buron.coffee/ws.php?format=json&method=pwg.session.login
with the body :

{
"username":"test",
"password":"test"
}

and it returns the same error, which it is not the good one, no ?

Actually I already test to post this : `https://piwigo.buron.coffee/ws.php?format=json&method=pwg.session.login` with the body : ``` { "username":"test", "password":"test" } ``` and it returns the same error, which it is not the good one, no ? <!-- github-comment-id:317704984 -->
Author
Owner

you can try set request content type to application/x-www-form-urlencoded
body like this:
username=test&password=test

you can try set request content type to `application/x-www-form-urlencoded` body like this: username=test&password=test <!-- github-comment-id:406552636 -->
Author
Owner

I have been discussing with a user having the same issue. He was indeed sending a POST request, but all his parameters were in GET (in the URL), not in POST. The POST array was empty, thus the error thrown by Piwigo.

Only {format, method} must be in GET, other parameter in POST.

I have been discussing with a user having the same issue. He was indeed sending a POST request, but all his parameters were in GET (in the URL), not in POST. The POST array was empty, thus the error thrown by Piwigo. Only `{format, method}` must be in GET, other parameter in POST. <!-- github-comment-id:470599738 -->
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: adam/Piwigo#683