I tried multiple time and double check the item ID and project Id I am useing are correct, but still I get this error response:
{ "developerMessage":"The requested resource does not exist.", "moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/", "errorCode": ""}
Could there anyone help to suggest if there something wrong with my code here below?
Console.WriteLine("start");
// Set up HttpClient
HttpClient client = new HttpClient();
client.BaseAddress = new Uri("https://developer.api.autodesk.com/");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
// Set up access token
string accessToken = GetToken().Result;
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accessToken);
// Set up request parameters
string projectId = Program.projectId;
// Get project attributes
string requestUrl = $"bim360/docs/v1/projects/{projectId}/folders/{folderId}/custom-attribute-definitions";
HttpResponseMessage response = client.GetAsync(requestUrl).Result;
string responseContent = response.Content.ReadAsStringAsync().Result;
// Verify version id
var versionApi = new VersionsApi();
versionApi.Configuration.AccessToken = GetToken().Result;
//Console.WriteLine(versionApi.GetVersion("b."+projectId,versionId_TestFile));
Console.WriteLine();
// Parse response JSON
dynamic attributes = JsonConvert.DeserializeObject(responseContent);
Console.WriteLine(attributes.results);
dynamic updatedAttributes = new[]
{
new { id = 3630054, value = "I luv uu" },
new { id = 3555365, value = "I luv uu" },
};
// Update project attributes
requestUrl = $"bim360/docs/v1/projects/{projectId}/versions/{versionId_TestFile}/custom-attributes:batch-update";
var patchContent = new StringContent(JsonConvert.SerializeObject(updatedAttributes), Encoding.UTF8, "application/json");
var patchResponse = await client.PostAsync(requestUrl, patchContent);
string patchResponseContent = await patchResponse.Content.ReadAsStringAsync();
Console.WriteLine(patchResponseContent);
Console.Read();
I am trying to update the customs attribute for the file saved in ACC.