Jump to content
Updated Privacy Statement
  • 0

Assigning user when adding machine to delivery group using REST API in C#


Jeremy Gove

Question

Does anyone know the proper syntax for the JSON body in the HTTP request when assigning a user while adding a machine to a delivery group using REST API in C#?

 

I can add a machine with no users.  However, if I try to assign a user, it either still adds it without a user, or it returns a 400 error.

 

I made a custom object for the request body based on the documentation and serialize that, but I've also tried the JSON manually.  I've tried these and probably some variations (for some reason, it tends to serialize the C# string "domain\\computername" with four slashes, even though I'm escaping the slash character -- if I put in one slash the code doesn't compile).

 

As you can see below, I've tried my U.P.N. for the username, as well as domain\username.

 

"{\"MachineCatalog\":\"CatalogueName\",\"Count\":1,\"AssignMachinesToUsers\":{\"Users\":[\"myupn\"],\"Machine\":\"domain\\computername\"}}"
"{\"MachineCatalog\":\"CatalogueName\",\"Count\":1,\"AssignMachinesToUsers\":{\"Users\":[\"domain\\myusername\"],\"Machine\":\"domain\\computername\"}}"
"{\"MachineCatalog\":\"CatalogueName\",\"Count\":1,\"AssignMachinesToUsers\":{\"Users\":[\"myupn\"],\"Machine\":\"domain\\\\computername\"}}"

"{\"MachineCatalog\":\"CatalogueName\",\"Count\":1,\"AssignMachinesToUsers\":{\"Users\":[\"domain\\myusername\"],\"Machine\":\"domain\\\\computername\"}}"

 

This is the guide I am following:

 

https://developer-docs.citrix.com/en-us/citrix-daas-service-apis/citrix-daas-rest-apis/apis/#/DeliveryGroups-APIs/DeliveryGroups-DoAddMachines

 

Thank you!

 

 

 

 

Link to comment

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...