Retrieving Issues for Equipment
Autodesk 'BIM for Owners' Event

Adding High Level Category to the Issue Type

Q.  Is there a way to add a new high level category to the issue type using Field API?  

A.  Please try:

POST /fieldapi/issues/v1/create_type

This method takes a name of category and a name of issue type:

  • ticket
  • project_id
  • category_name – string. The name of category (e.g., Punch List, Safety)
  • name – string. The name of issue type within the category. (e.g., Observation, Concealment Work to Complete).

If the top level category does not exist, the new category will be created with the given name. Otherwise, the issue type will be added to the existing category. 

On success, it will return Status Code "Created". 

Here is the sample response: 

{
    "category_name":"API Punch List",
    "name":"API Punch List Type",
    "id":"32efce5d-5bbe-4256-935f-d8ed968f6a2d",
    "full_name":"API Punch List::API Punch List Type"
}

Below is a snapshot of new category created using the create_type method.    

 CreateCategory

 Here is a rather straightforward sample code in C# and RestSharp: 

IssuesCreateType()
        public IRestResponse IssuesCreateType(string ticket, string project_id, string category_name, string name)
        {
            // (1) Build request

            // set base url and authentication info.
            var client = new RestClient();
            client.BaseUrl = new System.Uri(_baseUrl);

            // Set resource or end point
            var request = new RestRequest();
            request.Resource = "/fieldapi/issues/v1/create_type";
            request.Method = Method.POST;

            // Add parameters
            request.AddParameter("ticket", ticket);
            request.AddParameter("project_id", project_id);

            request.AddParameter("category_name", category_name);
            request.AddParameter("name", name);

            // (2) Execute request and get response
            IRestResponse response = client.Execute(request);

            return response;
        }

Mikako

Comments