Happy 4th of July!
Lab5 View and Data API Intro - Get Properties & Search

Updating a Custom Field of an Issue by Field API

Q. I want to update a custom field of a given issue through the Field API. Is it possible?

A. It is possible to update a portion of fields of an issue. You can use the call:

POST /fieldapi/issues/v1/update 
https://bim360field.autodesk.com/apidoc/index.html#issues_api_method_12

In fact, it is similar to what we have showed in “Field API Intro” Labs code for creating an issue. The difference is that, instead of using temporary_id which is arbitrary, you specify the id of an existing issue.

Steps to update a field of an issue would be as follows:

  1. Get the project id: POST /fieldapi/admin/v1/project_names
  2. Get issue field id: POST /fieldapi/issues/v1/fields
  3. Get issue id: POST /fieldapi/issues/v1/list
  4. Update issues with the custom fields: POST /fieldapi/issues/v1/update

Among above steps, (1) and (3) are covered in the Field API Intro Labs. I refer to that post for detail. For (2) and (4), below are additional details. 

 

Issue Fields

Gets a list of fields.

URL: https://bim360field.autodesk.com/fieldapi/issues/v1/fields

Method: POST

Parameters

  • ticket 
  • project_id 

Doc:
https://bim360field.autodesk.com/apidoc/index.html#issues_api_method_7

Here is the sample response (with formatting for readability):

{
    "common":
        {
            "fields":
                [
                    ...
                    {
                        "id": "cf--e10f230a-df98-4851-121c-83b2435f21c6",
                        "name": "Custom date",
                        "display_type": "date",
                        "required": false,
                        "possible_values": [],
                        "position": 20001
                    }
                ]
        }
}

id is the id of field that we are interested in. The id starts with "cf--" for a custom field. 


Issue Update

Once you have obtained issue and the custom field, you can pass an array of issues with the new field data that you want to update. .

URL: https://bim360field.autodesk.com/fieldapi/issues/v1/update

Method: POST

Parameters

  • ticket 
  • project_id
  • issues: 

Doc:
https://bim360field.autodesk.com/apidoc/index.html#issues_api_method_12

Here is an example of issues parameter:
[
  {
    "id":"00bedae6-2b5f-426e-8258-da876cb5f653",
    "fields":
      [
        {
          "value":"2015-07-07",
          "id":"cf--e10f230a-df28-4851-979c-83b8930f21c6"
        }
      ]
  }
]

The first id (in brown) is the id of an issue. The second id (in blue) is the id of a custom field.

On success, a sample response will include "success":true, which looks like this: 

[{"success":true,"general_errors":[],"errors":[],"id":"00bedae6-2b5f-426e-8258-da876cb5f653"} ... ]

 

Mikako

Comments