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

Getting Site id always throughs error : { "type": "https://errors-api.cloud.com/common/missing", "detail": "Missing required header", "parameters": { "property": "User-Agent" } }


Question

Hi,

where is my error.

 

I am trying to get the siteId with the following code:

 

       public static async Task<string> GetSiteId(string customerId,string bearerToken)
        {
            var requestUri = "https://api-us.cloud.com/cvad/manage/me";

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
                client.DefaultRequestHeaders.Add("Citrix-CustomerId", customerId);
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("CwsAuth", "bearer=" + bearerToken);

                var response = await client.GetAsync(requestUri);

                if (response != null)
                {
                    var content = await response.Content.ReadAsStringAsync();
                    return content;
                }

                return null;
            }
        }

 

 

 

when i call this code with:

            var _siteid = await GetSiteId(_customerid, _bearertoken);

 

i always get:

 

{
  "type": "https://errors-api.cloud.com/common/missing",
  "detail": "Missing required header",
  "parameters": {
    "property": "User-Agent"
  }
}

 

 

What's my Problem here ?

 

Best Regards

CBL

 

 

 

 

Link to comment

3 answers to this question

Recommended Posts

  • 0
On 4/1/2022 at 8:11 PM, Carsten Bartholomä-Link said:

Hi,

where is my error.

 

I am trying to get the siteId with the following code:

 

       public static async Task<string> GetSiteId(string customerId,string bearerToken)
        {
            var requestUri = "https://api-us.cloud.com/cvad/manage/me";

            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
                client.DefaultRequestHeaders.Add("Citrix-CustomerId", customerId);
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("CwsAuth", "bearer=" + bearerToken);

                var response = await client.GetAsync(requestUri);

                if (response != null)
                {
                    var content = await response.Content.ReadAsStringAsync();
                    return content;
                }

                return null;
            }
        }

 

 

 

when i call this code with:

            var _siteid = await GetSiteId(_customerid, _bearertoken);

 

i always get:

 

{
  "type": "https://errors-api.cloud.com/common/missing",
  "detail": "Missing required header",
  "parameters": {
    "property": "User-Agent"
  }
}

 

 

What's my Problem here ?

 

Best Regards

CBL VRL Tracking

 

 

 

 

Same problem . Now my issue solved

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