For anyone who stumbles upon this answer later, here's the code that worked
for me. Besides putting the actions in an array, I also had to use the user
ID rather than username.
$http.put("http://localhost:8380/auth/admin/realms/realm1/users/
09cf5f68-4ac0-4a87-a418-cb4bb7ddec91/execute-actions-email",
['VERIFY_EMAIL', 'UPDATE_PASSWORD'],
{
headers: {
Authorization: "Bearer eyJhb...",
Content-type: "application/json"
}
});
On Wed, Dec 14, 2016 at 9:29 PM, Roger Turnau (US - Advisory) <
roger.turnau(a)pwc.com> wrote:
Sebastien,
Thank you! That sorted it out. The only other error I got was that I
needed the user's ID rather than the username. Now the email is sending.
Thanks again,
Roger Turnau
On Wed, Dec 14, 2016 at 8:20 PM, Sebastien Blanc <sblanc(a)redhat.com>
wrote:
> actions is expecting a string array , so maybe something like :
> actions: ['VERIFY_EMAIL','UPDATE_PASSWORD'] ?
>
> On Thu, Dec 15, 2016 at 3:50 AM, Roger Turnau (US - Advisory) <
> roger.turnau(a)pwc.com> wrote:
>
>> Hi all,
>>
>> Can someone show me a quick example of how to create (preferably in
>> AngularJS) the PUT request to send an execute-actions-email to a user?
>>
>> I'm building a service in AngularJS to call the Admin REST service. I can
>> get the access token and make GET requests just fine, but the PUT request
>> on execute-actions-email is giving me errors.
>>
>> Here's what I have so far:
>>
>> $http.put("
>>
http://localhost:8380/auth/admin/realms/realm1/users/bob/exe
>> cute-actions-email
>> ",
>> {
>> actions: 'VERIFY_EMAIL&UPDATE_PASSWORD'
>> },
>> {
>> headers: {
>> Authorization: "Bearer eyJhb...",
>> Content-type: "application/json"
>> }
>> });
>>
>> But this gets the following error in Keycloak:
>>
>> 16:46:15,961 ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default
>> task-25) RESTEASY002005: Failed executing PUT
>> /admin/realms/realm1/users/bob/execute-actions-email:
>> org.jboss.resteasy.spi.ReaderException:
>> com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize
>> instance of java.util.ArrayList out of START_OBJECT token
>> at [Source: io.undertow.servlet.spec.ServletInputStreamImpl@10fb0244;
>> line: 1,column: 1]
>> at
>> org.jboss.resteasy.core.MessageBodyParameterInjector.inject(
>> MessageBodyParameterInjector.java:184)
>> at
>> org.jboss.resteasy.core.MethodInjectorImpl.injectArguments(M
>> ethodInjectorImpl.java:91)
>> at
>> org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInje
>> ctorImpl.java:114)
>> at
>> org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget
>> (ResourceMethodInvoker.java:295)
>> at
>> org.jboss.resteasy.core.ResourceMethodInvoker.invoke(Resourc
>> eMethodInvoker.java:249)
>> ...
>>
>> It seems not to like that second parameter, but I can't tell why. I
>> appreciate any help you can give on this one. I have no idea how this
>> request is supposed to look.
>>
>> Thank you,
>>
>> Roger Turnau
>>
>> ______________________________________________________________________
>> The information transmitted, including any attachments, is intended only
>> for the person or entity to which it is addressed and may contain
>> confidential and/or privileged material. Any review, retransmission,
>> dissemination or other use of, or taking of any action in reliance upon,
>> this information by persons or entities other than the intended recipient
>> is prohibited, and all liability arising therefrom is disclaimed. If you
>> received this in error, please contact the sender and delete the material
>> from any computer. PricewaterhouseCoopers LLP is a Delaware limited
>> liability partnership. This communication may come from
>> PricewaterhouseCoopers LLP or one of its subsidiaries.
>> _______________________________________________
>> keycloak-user mailing list
>> keycloak-user(a)lists.jboss.org
>>
https://lists.jboss.org/mailman/listinfo/keycloak-user
>>
>
>
--
*Roger Turnau*
PwC | Manager - Advisory Financial Services
Mobile: 850-228-2006 <(850)%20228-2006>
Email: roger.turnau(a)pwc.com
PricewaterhouseCoopers LLP
50 North Laura Street, Suite 3000, Jacksonville FL 32202
http://www.pwc.com/us
Save energy. Save a tree. Save the printing for something really important.
--
*Roger Turnau*
PwC | Manager - Advisory Financial Services
Mobile: 850-228-2006
Email: roger.turnau(a)pwc.com
PricewaterhouseCoopers LLP
50 North Laura Street, Suite 3000, Jacksonville FL 32202
http://www.pwc.com/us
Save energy. Save a tree. Save the printing for something really important.
______________________________________________________________________
The information transmitted, including any attachments, is intended only for the person or
entity to which it is addressed and may contain confidential and/or privileged material.
Any review, retransmission, dissemination or other use of, or taking of any action in
reliance upon, this information by persons or entities other than the intended recipient
is prohibited, and all liability arising therefrom is disclaimed. If you received this in
error, please contact the sender and delete the material from any computer.
PricewaterhouseCoopers LLP is a Delaware limited liability partnership. This
communication may come from PricewaterhouseCoopers LLP or one of its subsidiaries.