[midPoint] assign account REST call

midpoint at mybtinternet.com midpoint at mybtinternet.com
Fri Jul 24 18:14:49 CEST 2015


Hi Katarina,
  Thank you. I notice you are using a POST rather than a PATCH as suggested on the Wiki; suspect it
  does not make much of a difference.
  When testing through the UI, I did not see the same error. I was doing an account add, rather than
  an assignment, which worked. After extensive testing, I believe the problem was a mapping script
  for DN; when the assignment was a role, it worked, but when the assignment was an account, it
  was unable to get the OID and the script failed. Rewrote it to test for the condition - works now.
Regards,
  Anton
----Original message----
>From : katkav at evolveum.com
Date : 23/07/2015 - 04:58 (BST)
To : antono at btinternet.com, midpoint at lists.evolveum.com
Subject : Re: [midPoint] assign account REST call
Hi Anton,
more comments are inline. At the beginning - this is call and modification I used (and worked for me) :
CURL command
curl.exe --user administrator:5ecr3t -H "Content-Type: application/xml" -X POST http://localhost:8080/midpoint/model/rest/users/fbe385c9-0205-4245-ad0f-30ae90ef99b4 -d @C:\midpoint\samples\rest\modification-assign-account.xml -v
modification-assign-account.xml
<objectModification xmlns='http://midpoint.evolveum.com/xml/ns/public/common/api-types-3' xmlns:c='http://midpoint.evolveum.com/xml/ns/public/common/common-3'
      xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3">
    <itemDelta>
        <t:modificationType>add</t:modificationType>
        <t:path>c:assignment</t:path>
        <t:value>
            <c:construction xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3">
                <c:resourceRef oid="resource-0000-0000-0000-000000000001" />
            </c:construction>
        </t:value>
    </itemDelta>
</objectModification>
Best Regards,
Katarina Valalikova
From: "ANTON OPPERMAN" <antono at btinternet.com>
To: midpoint at lists.evolveum.com
Sent: Wednesday, July 22, 2015 4:01:57 PM
Subject: [midPoint] assign account REST call
Hi Guys,
  Trying to assign an account to a user using REST api; copied and modified modification-assign-account.xml from samples.
  I replaced the resource OID with that of my target resource and deleted the line: <oid>there will be oid</oid>
This should be OK, the line <oid>there will be oid</oid> is not needed in the sample.
  If I understand correctly, if there is no OID supplied, midPoint should generate one; however the call fails with:
Yes, midPoint generates oid for objects while they are created/imported. But if you want to modify object (assign account to user) you need to know oid of object you are going to modify.
java.lang.NullPointerException: Cannot invoke method getOid() on null object (new) expression in mapping in outbound mapping for {.../connector/icf-1/resource-schema-3}name in resource:ef2bc95b-76e0-48e2-86d6-3d4f02d3eaef(Active Directory Internal)
Did you try to assign account via GUI? I think this error might be related with incorrect expression in outbound mapping for the name attribute ({.../connector/icf-1/resource-schema-3}name). If you didn't try to assign account via GUI before, could you please try it if it works? Let me know.
  This seems to target the intended resource and if I leave the original <oid> line in tact, the call fails with the same error.
  Any hints would be appreciated. Some more REST examples would also be welcome ...
Thx,
  Anton
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com
http://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20150724/4b549d45/attachment.htm>


More information about the midPoint mailing list