CMDBuild Forum

Rest Api Error init session

Hi,
I’m trying to init session via Rest Api but I’ve anerror response.

I send a post request to url
https://<cmdbuild_host>/cmdbuild/services/rest/v3/sessions?scope=service&returnId=true

with headers

username
password
content-type application/json

I get this error
IllegalArgumentException: missing required payload content

thanks

Hi,
Try this in your setup

/bin/curl --noproxy ‘*’ -X POST -sk --location ‘https://<cmdbuild_host>/cmdbuild/services/rest/v3/sessions?scope=service&returnId=true’ --header ‘Content-Type: application/json’ --data ‘{“username”:“user_api”,“password”:“superstrongpassword1”}’

user_api must exist in cmdbuild database

Br,
Peter

Hi
I’m trying to send a post request with

“Request Headers”: {
“content-type”: “application/json”,

},
“Request Body”: “{\r\n “username”: “my_user”,\r\n “password”: “my_pwd”\r\n}”,


But I can’t again obtain a session id

In cmdbuild_sys.log I can see this message:

2023-04-26T10:45:12.536+02:00 [system] ERROR o.c.audit.RequestTrackingServiceImpl - error processing request completion
java.lang.RuntimeException: error converting value for class = _Request attribute = SessionId from value =< … > ( java.lang.String )

Caused by: java.lang.RuntimeException: error converting raw value =< … > ( String ) for attribute type = StringAttributeType{length=50}

Caused by: java.lang.IllegalArgumentException: string ‘…’ exceed maximum attr len of 50

thanks