cancel
Showing results for 
Search instead for 
Did you mean: 

IDM RESTv2 API - Unable to modify a reference attribute

markus_sauer
Explorer
0 Kudos

Hi,

we are planing to use the RESTv2 API to implement our "own IDM-WebService API",
that can be used by other applications to trigger IDM processes in our system.
(Like "Create a new application Role for application X" or "Reset password of user X".)

The first tests were very promising.
Reading the content of entries, modifying single- and multivalue text attributes, assigning privileges, .... everything works, BUT I am not able to modify the value of a “singleValue reference attribute.

The scenario is like this:

  • In the schema we have an entryType “PERSON” and an attribute “REF_CHEF”, that is an optional attribute of “PERSON”.
  • REF_CHEF is singleValue and a reference attribute, that contains a reference to another entry with entryType PERSON.
  • We have a UI Form which allows the modification of REF_CHEF in an entry of ET PERSON.

So according to the documentation I call the URI:

https://localhost:19443/idmrestapi/v2/service/ET_PERSON(ID=127099,TASK_GUID=guid'7E8D9DF6-C2E0-4E84-8AE8-BDA94D958B3A')

with a JSON formated body like this:

{
"ER_REF_CHEF": [
{
"REFERENCED_ID": 113368,
"OPERATION": "REPLACE"
}
]
}

(Beside “REPLACE” I also tried “MOD”. I also tried providing "LINK_ID" without doing anything good.)


In Postman this looks like this.:


The message I receive is this:

<?xml version="1.0" ?>
<error xmlns=http://schemas.microsoft.com/ado/2007/08/dataservices/metadata>
<code>Bad Request</code>
<message xml:lang="en">Unerwarteter Wert für Parameter ER_REF_CHEF</message>
</error>

Roughly translated it says “Unexpected Value for parameter ER_REF_CHEF
I´d like to point out that there seems to be an additional whitespace between “Wert” and “für”.
Maybe the value of REFERENCED_ID was not passed or parsed correctly.

I would be very grateful for any hint.

Best Regards,

Markus

markus_sauer
Explorer
0 Kudos

UPDATE:
I continued my research and found that the URI and the JSON body I descripted in my question
are working fine, IF the reference attribute is a multivalue attribute.

So I have to rephrase my question to "How can I modify a SINGLEVLAUE reference attribute?"

In the SAP docs I found that this kind of URI could be used for a POST request to modify EntryReferences:

URI ='./idmrestapi/v2/service/ET_'EntryType'(ID='Mskey',TASK_GUID='TaskGUID')/ER_'AttributeName;

So I tried:
https://localhost:19443/idmrestapi/v2/service/ET_PERSON(ID=127099,TASK_GUID=guid'7E8D9DF6-C2E0-4E84-8AE8-BDA94D958B3A')/ER_REF_CHEF

but whatever JSON body I'am sending I always get this message:

<?xml version="1.0" ?>
<error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
<code></code>
<message xml:lang="en">The request is not supported by the processor.</message>
</error>

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member187331
Participant

Okay nevermind, I did not look into the payload good enough, yours is only valid for multivalve entry-references.

That's the correct one:

{
"ER_REF_CHEF": {
"REFERENCED_ID": 113368,
"OPERATION": "REPLACE"
}
}
markus_sauer
Explorer
0 Kudos

Yes, but no luck. ==> The request is not supported by the processor

former_member187331
Participant
0 Kudos

Yeah, that is not a valid payload for entry-reference attributes.

thbuett
Explorer
0 Kudos

Hello Markus,

cause it is a Single-Value, did you simply try to write it, like a Single-Value:

 {
    "ER_REF_CHEF" : 113368
}    

Greetings,

Thomas

former_member187331
Participant
0 Kudos

This is how a successful payload for single-value Entry-References looks like (taken from a productive system):

thbuett
Explorer
0 Kudos

Yes, Markus tried this, so I thought, cause it is a single value, maybe he has to write it like a single value, not like a reference. was a try

markus_sauer
Explorer
0 Kudos

Yes,

{
"ER_REF_CHEF": {
"REFERENCED_ID": 113368,
"OPERATION": "REPLACE"
}
}

is working.
The square brackets I added where wrong.

 {
"ER_REF_CHEF": [ <==========================
{
"REFERENCED_ID": 113368,
"OPERATION": "REPLACE"
}
] <==========================
}


THANKS A LOT!!!!

markus_sauer
Explorer
0 Kudos

Sure, here´s the config of the attribute

No validation, no given attribute Values, ...
We have event Tasks, but they shouldn´t matter, ... they start AFTER the action on the attribute.

Markus

former_member187331
Participant
0 Kudos

Hello Marcus,

can you make screenshots of the attribute? In particular what presentation type is set up? Also please provide the headers of the request.

I always restart the IdM JMX App as soon as I do changes on forms/attributes. Can you restart the app and send the request again?

The request payload itself looks okay.

Kind regards,

Aydin

markus_sauer
Explorer
0 Kudos

Good idea, but I restarted the AS Java without a positive effect.