Jump to content
Welcome to our new Citrix community!
  • 0

REST API - "MachineCatalogs_AddMachineCatalogMachine" returning - Our services aren't available right nowWe're working to restore all services as soon as possible


Remi Roy1709163296

Question

Hi,

 

Note After have open an official support ticket, I was redirected here by support for this issue. - my original question was when will it be fixed (because from the API call response that seem to be an issues on Citrix side)


We have fully automated the VM delivery process to our users using the Citrix REST API, as for August 10th we noticed that the process was failing. Looking into it, it turns out that the API calls to ADD a VM inside a machine catalog is not returning the ID as it should. we are using that call : https://developer.cloud.com/citrixworkspace/citrix-daas/citrix-daas-rest-apis/apis/MachineCatalogs-APIs/MachineCatalogs_AddMachineCatalogMachine

 

We got the following message from the API call : "Service unavailableOur services aren't available right nowWe're working to restore all services as soon as possible. Please check back soon." 

Or

"The specified CGI application encountered an error and the server terminated the process."

 

The call do in fact create(add) the machine to the machine catalog following the namingscheme provided in the body of the api call. But the API call itself never return a proper body that we can use.

 

We are using the following powershell code :

 

Invoke-RestMethod "https://api-us.cloud.com/cvad/manage/MachineCatalogs/$setmc/Machines" -Method Post -Headers $headers -ContentType "application/json" -Body $body

where "$body" is :

{
    "MachineAccountCreationRules":  {
                                        "NamingScheme":  "CE-1234-####",
                                        "NamingSchemeType":  "Numeric"
                                    }
}

and "$setmc" the name of the Machine Catalog that we target

 

 

We did not change anything on the way we do call the API, i was working without issue for months , we required the ID returned by the call to make sure that the job as in fact completed, inprogress or failed, and retrieve the VM name from another API call using that ID.

 


Also tried using the "Invoke Api" from the Citrix Web Page to do the same thing  (to rule out powershell) and it's also not working, the response section of the query look like this (see  "error api" attached file)

 

 

Thank in advance for your help!

error api.png

Link to comment

4 answers to this question

Recommended Posts

  • 0

Hi, Remi. We usually use batch api to add machines. But the call to MachineCatalogs_AddMachineCatalogMachine should works as well.

I try to use a request body similar with yours and can add machines. So the request body is fine. I'm not sure if you add X-AdminCredential header into the headers/

 

One thing to note, it's recommended that using "https://api-us.cloud.com/cvad/manage/MachineCatalogs/$setmc/Machines?async=true" to avoid "The specified CGI application encountered an error and the server terminated the process." This error is caused by timeout of 30s. 

 

For "Service unavailableOur services aren't available right nowWe're working to restore all services as soon as possible. Please check back soon.", I need your help to try:

"https://$customerid.xendesktop.net/citrix/orchestration/api/techpreview/$customerid/$siteid/MachineCatalogs/$setmc/Machines?async=true" with the same body and headers.

Thank you!

 

Update:

I have checked failed requests for industrielle since August 10. 2 faile for invalid bearer token and others failed after ~30s. So please try adding "?async=true" first.

Link to comment
  • 0

Hi Ji Gao,

 

I am working along side Remi on the same issue, I have tried the async=true but then I don't get any job id's, my previous API calls without the Async used to get me a job id which I could then leverage to get the machine name tied to that specific API call.

 

This API is call is part of the larger workflow and hence we would need the job id, any thoughts on how to proceed with this ?

 

Thank you !!

 

JFYI, I have tried both calls as defined below:

"$vdiintg = Invoke-RestMethod "https://api-us.cloud.com/cvad/manage/MachineCatalogs/$setmc/Machines?async=false" -Method Post -Headers $headers -ContentType "application/json" -Body ($cacc | ConvertTo-Json)"

 

"$vdisome = invoke-restmethod "https://$customerid.xendesktop.net/citrix/orchestration/api/techpreview/$customerid/$siteid/MachineCatalogs/$setmc/Machines?async=true" -Method Post -Headers $headers -ContentType "application/json" -Body ($cacc | ConvertTo-Json)"

 

Also, I am testing the above API calls in my lab tenant.

Link to comment
  • 0

Hi Kunal. Sorry for the late response.

You're right. The job id cannot be found for this API. If you need the job id, you can try using Batch API to add machines.

An example body to add 2 machines:
https://88xcgw2hgllw.xdtesting.net/citrix/orchestration/api/techpreview/88xcgw2hgllw/c38ab1e5-1d91-46ff-b84e-f92c0bcf9d85/$batch?async=true

{
    "Items": [
        {
            "Reference": "0",
            "Method": "POST",
            "RelativeUrl": "/techpreview/88xcgw2hgllw/c38ab1e5-1d91-46ff-b84e-f92c0bcf9d85/MachineCatalogs/9363e804-324b-4a1e-92c5-bc5980aff7aa/Machines",
            "Headers": [
                {
                    "Name": "X-AdminCredential",
                    "Value": "Basic XXXX"
                },
                {
                    "Name": "Authorization",
                    "Value": "Bearer XXXXX"
                },
                {
                    "Name": "X-CC-Locale",
                    "Value": "en"
                }
            ],
            "Body": "{\"MachineAccountCreationRules\":{\"NamingScheme\":\"intunetest##\",\"NamingSchemeType\":\"Numeric\",\"Domain\":\"jitest24.icu\",\"OU\":\"CN=AAD Computers,DC=jitest24,DC=icu\"}}"
        },
        {
            "Reference": "1",
            "Method": "POST",
            "RelativeUrl": "/techpreview/88xcgw2hgllw/c38ab1e5-1d91-46ff-b84e-f92c0bcf9d85/MachineCatalogs/9363e804-324b-4a1e-92c5-bc5980aff7aa/Machines",
            "Headers": [
                {
                    "Name": "X-AdminCredential",
                    "Value": "Basic XXXX"
                },
                {
                    "Name": "Authorization",
                    "Value": "Bearer XXXXX"
                },
                {
                    "Name": "X-CC-Locale",
                    "Value": "en"
                }
            ],
            "Body": "{\"MachineAccountCreationRules\":{\"NamingScheme\":\"intunetest##\",\"NamingSchemeType\":\"Numeric\",\"Domain\":\"jitest24.icu\",\"OU\":\"CN=AAD Computers,DC=jitest24,DC=icu\"}}"
        }
    ]
}

You can see the batch job id in the Location header of the response:
https://88xcgw2hgllw.xdtesting.net/citrix/orchestration/api/techpreview/88xcgw2hgllw/c38ab1e5-1d91-46ff-b84e-f92c0bcf9d85/Jobs/0b178cb0-8830-4e01-943a-b1ac2fda8308

 

In the batch job result, you can find the job of adding machines
 

Link to comment
  • 0
{
  "Items": [
    {
      "Reference": "0",
      "Code": 202,
      "Headers": [
        {
          "Name": "Location",
          "Value": "https://88xcgw2hgllw.xdtesting.net/citrix/orchestration/api/techpreview/88xcgw2hgllw/c38ab1e5-1d91-46ff-b84e-f92c0bcf9d85/Jobs/c99690cd-b616-4621-b23c-a2a3556b5a48"
        }
      ],
      "Body": null
    },
    {
      "Reference": "1",
      "Code": 202,
      "Headers": [
        {
          "Name": "Location",
          "Value": "https://88xcgw2hgllw.xdtesting.net/citrix/orchestration/api/techpreview/88xcgw2hgllw/c38ab1e5-1d91-46ff-b84e-f92c0bcf9d85/Jobs/c99690cd-b616-4621-b23c-a2a3556b5a48"
        }
      ],
      "Body": null
    }
  ]
}

 

Link to comment

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...