- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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)"
}
Lien copié
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hello Jools86,
Thank you so much for your patience.
After analyzing your request, we have come to the conclusion that this is not a bug, but a syntax issue. It looks like you are attempting to use an array $UPN=@()
Swagger syntax calls for the UPN to be a call for a "string"... "UserName": "string"
If you remove the array and turn it into a string it should work fine:
#Example
$UPN="Julian.Loveday@mydomain.com"
#// Add to User Group
$Body = @{
'UserName'=$UPN
}
$JSON=$Body | ConvertTo-Json
Write-Host $JSON
the output will look like as opposed to nothing in an array
{
"UserName": "Julian.Loveday@mydomain.com"
Best regards,
Victor G.
Intel Technical Support Technician
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hello Jools86,
Were you able to check the previous post?
Please let me know if you need further assistance.
Best regards,
Victor G.
Intel Technical Support Technician
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
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
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable