- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
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
There is definitely something wrong with this API call.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
=========================================

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page