0

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

Rmahajan
  • 1,311
  • 1
  • 14
  • 23
  • Also I have updated access.js file to allow the pattern /managed/zzzz/* in openidm – Rmahajan Aug 28 '18 at 12:45
  • ahhh I figure it out. If you add --request in the curl command it is behaving as expected. $ curl -k -s --request 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"'"}' – Rmahajan Aug 29 '18 at 13:41
  • If you don't specify the method of your request the default one is a GET request. Anyway OpenIDM will always use an internal _id to identify an object. – LucaP Sep 10 '18 at 11:46

0 Answers0