OPENIDM- HTTP PUT cURL request

197 Views Asked by At

I'm new to openIDM, I'm trying to execute the following query, getting proper results as expected which is POST.

$ curl -k -s https://localhost/openidm/managed/zzzz?_action=create -H 'Content-Type: application/json' -H 'X-OpenIDM-Username: '"openidm-admin"'' -H 'X-OpenIDM-Password: '"openidm-admin"'' -H 'Accept: application/json' -d 
'{ "x": "'"AA1"'", "xx": "'"xx"'", "xxx": "'"xxx"'","xxxx": "'"xxxx"'"}'

Results:

{"_id":"db0489f6-d390-481f-8708-0970b3e42469","_rev":"0","x":"AA1","xx":"xx","xxx":"xxx","xxxx":"xxxx"}

But I want to have id value to be created as client Assigned ID not the one generated by openidm, and for that I am using PUT command as below

$ curl -k -s PUT https://xxxx/openidm/managed/zzzz/AA1 -H 'Content-Type: application/json' -H 'X-OpenIDM-Username: '"openidm-admin"'' -H 'X-OpenIDM-Password: '"openidm-admin"'' -H 'Accept: application/json' -d '{ "x": "'"AA1"'", "xx": "'"xx"'", "xxx": "'"xxx"'","xxxx": "'"xxxx"'"}'

Result :

{"code":400,"reason":"Bad Request","message":"The resource instance /managed/zzzz/AA1 cannot be created"}

Output what I want is

{"_id":"AA1","_rev":"0","x":"AA1","xx":"xx","xxx":"xxx","xxxx":"xxxx"}

I am not sure what I'm doing wrong, Any suggestion ? I followed openidm documentation and below is the link for that.

https://backstage.forgerock.com/docs/idm/5.5/integrators-guide/#about-crest-create

0

There are 0 best solutions below