Intel vPro® Platform
Intel Manageability Forum for Intel® EMA, AMT, SCS & Manageability Commander
Announcements
All support for Intel NUC 7 - 13 systems has transitioned to ASUS. Read latest update.
2816 Discussions

RestAPI - Add userGroup members not working

Jools86
New Contributor II
1,144 Views

I have previously posted this, and you told me to use a string value instead of an array. This also does not work, and I had already tried this before raising this case.

 

Using the following POST method via PowerShell:

https://localhost/api/v5/userGroupMemberships/{userGroupId}/addMembers

 

I set the body as 

 

$UPN=@()
$UPN+="Julian.Loveday@mydomain.com"

#// Add to User Group
$Body = @{
'UserName'=$UPN
}
$JSON=$Body | ConvertTo-Json
$UserGroup=Invoke-RestMethod "https://ema.mydomain.com/api/latest/userGroupMemberships/$EMAUserGroupId/addMembers" -Headers $headers -Body $JSON -Method Post

 

however I see this error every time:

Jools86_0-1678723494701.png

 

 

I tried changing to

$UserGroup=Invoke-RestMethod "https://ema.mlp.com/api/latest/userGroupMemberships/$($EMAUserGroupId)/addMembers" -Headers $headers -Body $JSON -Method Post

 

and even changing to

$UserGroup=Invoke-RestMethod "https://ema.mlp.com/api/latest/userGroupMemberships/1/addMembers" -Headers $headers -Body $JSON -Method Post

 

Could you either:

a) Confirm there is a BUG in the RestAPI for adding members

or b) Send me an example if I am getting the syntax wrong.

 

As an FYI, token generates fine (code to generate headers below) - and I can run most other RestAPI queries using the below, its this specific one (https://localhost/api/v5/userGroupMemberships/{userGroupId}/addMembers) that is broken.

 

#// Generate token to be passed for authorization with each RestAPI request
$Token=Invoke-RestMethod "https://mydomain.mlp.com/api/latest/accessTokens/getUsingWindowsCredentials" -Credential $Cred

#// Generate header including token for each API request
$headers = @{
'authorization' = "bearer $($Token.access_token)"
}

 

If I change the BODY to not use an array, but just a string value it fails as well:

 

$UPN="Julian.Loveday@mydomain.com"

#// Add to User Group
$Body = @{
'UserName'=$UPN
}
$JSON=$Body | ConvertTo-Json
$UserGroup=Invoke-RestMethod "https://ema.mydomain.com/api/latest/userGroupMemberships/$EMAUserGroupId/addMembers" -Headers $headers -Body $JSON -Method Post

Jools86_1-1678724629377.png

 

There is definitely something wrong with this API call.

0 Kudos
9 Replies
Victor_G_Intel
Moderator
1,128 Views

Hello Jools86,

 

Thank you for posting on the Intel® communities.

 

Please let me review this information internally, and kindly wait for an update.

 

Once we have more information to share, we will post it on this thread.

 

Regards,

 

Victor G.

Intel Technical Support Technician  


0 Kudos
Victor_G_Intel
Moderator
1,124 Views

Hello Jools86,


To continue with the investigation on our end can you please confirm the version of EMA that you are currently working with?


Regards,

 

Victor G.

Intel Technical Support Technician  


0 Kudos
Jools86
New Contributor II
1,112 Views
0 Kudos
Victor_G_Intel
Moderator
1,101 Views

Hello Jools86,


We appreciate your response.


We'll keep you posted on our findings and in case we need anything else from your end we will reach back through the forum.


Regards,

 

Victor G.

Intel Technical Support Technician  


0 Kudos
Victor_G_Intel
Moderator
1,035 Views

Hello Jools86,


Thank you so much for your patience.


At this time, based on the environment that you are currently experiencing this situation on our strongest recommendation is to update EMA to version 1.10.


Best regards,


Victor G.

Intel Technical Support Technician  


0 Kudos
Victor_G_Intel
Moderator
973 Views

Hello Jools86,


Were you able to check the previous post?   


Please let me know if you need further assistance.  

 

Regards,


Victor G. 

Intel Technical Support Technician  


0 Kudos
Victor_G_Intel
Moderator
908 Views

Hello Jools86,


We have not heard back from you.


If you need any additional information, please submit a new question as this thread will no longer be monitored.


Regards,


Victor G.

Intel Technical Support Technician


0 Kudos
Jools86
New Contributor II
884 Views

Hi Victor, I was locked out of forum since SAML change.

 

I will update to 1.10 after easter and feed back to the forum.

0 Kudos
Jools86
New Contributor II
883 Views

Fix was as follows:

 

The bit in bold to format the body as an array fixed the issue - thanks to Josh.

 

========================================

$UPN=@()
$UPN+="Julian.Loveday@mydomain.com"

#// Add to User Group
$Body = @{
'UserName'=$UPN
}
$Body=$Body | ConvertTo-Json

$JSON=Convert-ToJson -inputobject @($Body)


$UserGroup=Invoke-RestMethod "https://ema.mydomain.com/api/latest/userGroupMemberships/$EMAUserGroupId/addMembers" -Headers $headers -Body $JSON -Method Post

=========================================

 

0 Kudos
Reply