GuestAPI change password, email, username

I have installed the GUESTAPI and I have login via API to omeka platform and I am trying to change password according to readme file,
Other http methods are available to update the profile with the same path. For example to update (http method PATCH/POST):

  • email: /api/users/me?email=elisabeth.ii@example.com
  • name: /api/users/me?name=elisabeth_ii
  • password: /api/users/me?password=xxx&new_password=yyy

But I get " Omeka\Mvc\Exception\PermissionDeniedException"
Permission denied for the current user to access the controller GuestApi\Controller\ApiController. in /var/www/html/omeka/application/src/Mvc/MvcListeners.php:449

Do you have any ides what might be wrong?

Thanks for your help

Hi Makatsis,
You should add the credentials “key_identity” and “key_credentials”.
Sincerely,

You are right Daniel!
I use the api with a url like this,
http://…/omeka/api/users/17?name=marios&key_identity=0KYkBBWzJ1MoaOo5348NGOpz75hDtxdP&key_credential=ILssz1yIAv7Szmjz67XEIrPyfi2jlaze

with the right key_identity and key_credential but the name is not changed. This also happens for email, password.

Am I missing something?

Thanks a lot for your help!

What is the response status code ?

I get 415 Unsupported Media Type.

As, I can undestand I am not using the right header for the PUT request.

Update
I add header Content-type: application/json and now I am getting
400 Bad Request
{“errors”:{“error”:“JSON: Syntax error”}}

I’ll check in a few days.

1 Like

Hello Daniel, did you find time to look it?

Thank you.

Hello Daniel, did you find time to look it?

Thank you.

Some times, the days are long… I know that the module is working (it is used in Hyper-Otlet), but I’ll check it next week, I’m busy for now.

Thank you Daniel!
My apollogies for the last message.

Hello Daniel,
I tried the module in Hyper-Otlet and I get the same error.
400 Bad Request
{“errors”:{“error”:“JSON: Syntax error”}}

Could you send me an example to check if I am wrong?

Thanks a lot!
Marios

Are you sure there’s not just a syntax error in the JSON you’re submitting to the API (or possibly you’re not submitting JSON at all)? That’s the simple answer here.

You are right! I was stacked in very wrong JSON format.
Sorry guys!

For memo, this format is working as post:

curl -X POST --data '{"email":"elisabeth.ii@example.org","password":"my-password"}' --header "Content-Type: application/json" 'https://example.org/api/login'

or as get:

curl 'https://example.org/api/login?email=elisabeth.ii@example.org&password=my-password'

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.