post user error

Any issue about Cyclos 4 scripting and Webservices

Moderators: alexandre, hugo, rmvanarkel

Post Reply
guigeek
Posts: 32
Joined: Fri May 08, 2020 11:26 am

post user error

Post by guigeek »

Hi,
i want to use the api for update full profile, with the post request but i have the following error :

{
"exceptionType": "org.cyclos.server.model.NestedFrameworkException",
"kind": "nested",
"conflictError": {
"code": "staleEntity"
},
"error": {
"exceptionType": "org.cyclos.model.StaleEntityException",
"kind": "general"
},
"property": "user"
}

I try to use the version parameter but nothing changes.
Someone can help me ?
Thanks
Regards,
Guillaume
rajesh
Posts: 22
Joined: Thu Jan 20, 2022 8:35 am

Re: post user error

Post by rajesh »

You will have call the Edit For Profile `GET /users/{user}/data-for-edit`, replace your custom values in that response object, and then call `PUT /users/{user}` to update.
guigeek
Posts: 32
Joined: Fri May 08, 2020 11:26 am

Re: post user error

Post by guigeek »

Hi thanks ! Its weird, i can see my custom values ( profile fields) when i get the data-for-edit.
Is it normal ?
Thanks,
Guillaume
rajesh
Posts: 22
Joined: Thu Jan 20, 2022 8:35 am

Re: post user error

Post by rajesh »

Yes it is normal. That's how cyclos works. You can update the customValues to whatever you wanted to update and the call the PUT and you are all done.
guigeek
Posts: 32
Joined: Fri May 08, 2020 11:26 am

Re: post user error

Post by guigeek »

I tried but my customvalues don't change. I have now no errors...
rajesh
Posts: 22
Joined: Thu Jan 20, 2022 8:35 am

Re: post user error

Post by rajesh »

May be the customValues are not updated properly. That needs a cross check.
guigeek
Posts: 32
Joined: Fri May 08, 2020 11:26 am

Re: post user error

Post by guigeek »

Ok thanks,
but how to do this cross check ?
guigeek
Posts: 32
Joined: Fri May 08, 2020 11:26 am

Re: post user error

Post by guigeek »

It's very strange because i can register user with post/Users with the customValues ! But i can't modify this values with the putUser :(
mcash
Posts: 14
Joined: Thu Jul 28, 2022 10:26 am

Re: post user error

Post by mcash »

Are you able to confirm what you're actually posting?

There is a possibility that you're posting back the old values.

Can you check log output or tcpdump output to verify what you're actually posting?
guigeek
Posts: 32
Joined: Fri May 08, 2020 11:26 am

Re: post user error

Post by guigeek »

In this example i want to change the Num_adherent_part to 423

PUT /api/users/-2852719781260026695 HTTP/1.1
Host: 192.168.100.14:8080
User-Agent: python-requests/2.21.0
Accept-Encoding: gzip, deflate
Accept: text/plain
Connection: keep-alive
Content-type: application/json
Content-Length: 189
Authorization: Basic YWRtaW5BUEk6QXplcnR5MTIzNDU2Nzg5

{"name": "Guillaume ROCHE TOTO", "username": "xxx@gmail.com", "email": "xxx@gmail.com", "hiddenFields": [], "version": 8, "customValues": {"Num_adherent_part": "423"}}HTTP/1.1 204
x-xss-protection: 1; mode=block
x-frame-options: SAMEORIGIN
Date: Thu, 01 Sep 2022 20:08:59 GMT
Keep-Alive: timeout=20
Connection: keep-alive

But when i connect the user to cyclos, i have still the old Num_adherent_part
Thanks
Regards
guigeek
Posts: 32
Joined: Fri May 08, 2020 11:26 am

Re: post user error

Post by guigeek »

I solve this !
The problem came from the permssion of the admin groups !
Thanks to you !
Regards!
Post Reply