Problems Updating (and Creating) Labels Through the API

I’m having some trouble updating (and creating) Labels through the API. Theoretically, it should be easier to Create, rather than to Update, so I’ve put a sample HTTP request below that seems like it should work for creating, but unfortunately, does not. Also note that the “Create attribute” API documentation (not the “Update attribute”) documentation does not provide any information about how to include the Label data in the Settings.

In the array of Label objects, if I don’t include an “id” key and value, it gives an error “Labels should be arrays with id, name and color keys”, but if I do include an “id” key, it gives an error “Invalid data “” supplied to “label” attribute: Data “’’” is not an array supplied to App\Item\Types\Label class.”

Anyone know how to Create/Update Label fields in Infinity?

`
POST /api/v2/workspaces/{WORKSPACE-ID}/boards/{BOARD-ID}/attributes HTTP/1.1
Authorization: Bearer {PERSONNAL-ACCESS-TOKEN}
Content-Type: application/json
Accept: application/json
Host: app.startinfinity.com
Connection: close
User-Agent: Paw/3.4.0 (Macintosh; OS X/11.7.1) GCDHTTPRequest
Content-Length: 165

{“name”:“Test Attr”,“type”:“label”,“default_data”:"",“settings”:{“labels”:[{“name”:“Test Name”,“color”:"#B3EC8D"}],“multiple”:true,“allowNew”:true,“allowEmpty”:true}}
`

2 Likes

NOTE: I have resolved the error in creating Attributes by changing the “default_data” field to an empty array instead of an empty string, and then making the object in the array of Labels to include name, color and id, where the id is blank.

Similarly, I can remove Labels from the attribute by just not including the information about the particular label option in the array of label objects, and I can add a new label option by leaving the id blank. Strangely, the Response data from Infinity still has the “id” for that option as blank, so to actually retrieve, the ID, I’ll have to do a seperate GET request after-the-fact.

2 Likes