Hi Katarina,<br><br>  Thank you. I notice you are using a POST rather than a PATCH as suggested on the Wiki; suspect it<br>  does not make much of a difference.<br><br>  When testing through the UI, I did not see the same error. I was doing an account add, rather than<br>  an assignment, which worked. After extensive testing, I believe the problem was a mapping script<br>  for DN; when the assignment was a role, it worked, but when the assignment was an account, it<br>  was unable to get the OID and the script failed. Rewrote it to test for the condition - works now.<br><br>Regards,<br>  Anton<br><br><br><blockquote style="margin-right: 0px; margin-left:15px;">----Original message----<br>From : katkav@evolveum.com<br>Date : 23/07/2015 - 04:58 (BST)<br>To : antono@btinternet.com, midpoint@lists.evolveum.com<br>Subject : Re: [midPoint] assign account REST call<br><br><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Hi Anton,<br></div><div><br></div><div><span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"></span></div><div>more comments are inline. At the beginning - this is call and modification I used (and worked for me) :</div><div><br></div><div><b><span style="text-decoration: underline;" data-mce-style="text-decoration: underline;">CURL command</span></b></div><div>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</div><div><br></div><div><br></div><div><b><span style="text-decoration: underline;" data-mce-style="text-decoration: underline;">modification-assign-account.xml</span></b></div><div><p style="margin: 0px;" data-mce-style="margin: 0px;"><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'</p><p style="margin: 0px;" data-mce-style="margin: 0px;">      xmlns:t="http://prism.evolveum.com/xml/ns/public/types-3"><br>    <itemDelta><br>        <t:modificationType>add</t:modificationType><br>        <t:path>c:assignment</t:path><br>        <t:value><br>            <c:construction xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"><br>                <c:resourceRef oid="resource-0000-0000-0000-000000000001" /><br>            </c:construction><br>        </t:value><br>    </itemDelta><br></objectModification></p></div><div><br></div><div><br></div><div>Best Regards,</div><div>Katarina Valalikova</div><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"ANTON OPPERMAN" <antono@btinternet.com><br><b>To: </b>midpoint@lists.evolveum.com<br><b>Sent: </b>Wednesday, July 22, 2015 4:01:57 PM<br><b>Subject: </b>[midPoint] assign account REST call<br><div><br></div>Hi Guys,<br><div><br></div>  Trying to assign an account to a user using REST api; copied and modified modification-assign-account.xml from samples.<br>  I replaced the resource OID with that of my target resource and deleted the line: <oid>there will be oid</oid></div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br></div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><span data-mce-bogus="true" style=""><i>This should be OK, the line <span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"><oid>there will be oid</oid> is not needed in the sample.</span></i></span></div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br>  If I understand correctly, if there is no OID supplied, midPoint should generate one; however the call fails with:<br><div><i style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;"><br></i></div><div><i style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">Yes, midPoint generates oid for objects while they are created/imported. But if you want to modify <i style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">object </i>(assign account to user) you need to know oid of object you are going to modify.</i></div><div><br></div><div><br></div>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)</div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><br></div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><i></i><i></i><i>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 (<span style="font-family: Helvetica, Arial, sans-serif;" data-mce-style="font-family: Helvetica, Arial, sans-serif;">{.../connector/icf-1/resource-schema-3}name</span>). If you didn't try to assign account via GUI before, could you please try it if it works? Let me know.</i><br><div><br></div>  This seems to target the intended resource and if I leave the original <oid> line in tact, the call fails with the same error.<br><div><br></div>  Any hints would be appreciated. Some more REST examples would also be welcome ...</div><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><div><br></div>Thx,<br>  Anton<br><div><br></div><br><div><br></div>_______________________________________________<br>midPoint mailing list<br>midPoint@lists.evolveum.com<br>http://lists.evolveum.com/mailman/listinfo/midpoint<br></div><div><br></div></div><br></blockquote><br><p></p>