To update an item in your project, you can send the PUT
command to the needed resource to replace the item’s existing contents with new contents, or you can use the PATCH
command to update the needed fields of the item.
The example below demonstrates how to use the PUT
command to update the entire contents of an existing defect.
To learn how to use the PATCH
command to update an item’s fields, see Change Defect Status.
Request
curl -u [email protected]:p@ssword -X PUT -d @defect.txt -H "Content-Type: application/json" -H "Accept: application/json" http://yourserver.com/rest-api/service/api/v1/projects/11873/defects/12
The defect.txt file contains the defect’s new contents:
{
"Title": "Floating toolbar improvements",
"Status": "Active",
"AssigneeUserId": 25264,
"Description": "The design of the floating toolbar needs improvement so that it’s clearer what the user needs to do.",
"HowFoundCode": "Code Review",
"IssueCode": "Code Defect",
"PriorityCode": "2-Fix Soon"
}
The server will replace the defect’s exisitng contents with the new contents. If you do not specify any values in some fields, the default values will be set.
Response
The server will return information on the updated defect:
{
"id": 12,
"title": "Floating toolbar improvements",
"status": "Active",
"__permissions": {
"acl": 7
},
"act_finish": "0001-01-01T00:00:00.0000000",
"act_hrs": 0,
"act_start": "0001-01-01T00:00:00.0000000",
"assigned_to_name": "Smith, John",
"assignee_user_id": 25264,
"closed_by": 0,
"custom_fields": [],
"date_closed": "0001-01-01T00:00:00.0000000",
"date_created": "2015-09-07T00:52:27.0700000",
"date_opened": "2015-09-07T00:52:27.0700000",
"date_resolved": "0001-01-01T00:00:00.0000000",
"date_updated": "2015-09-15T00:17:29.3000000",
"description": "The design of the floating toolbar needs improvement so that it’s clearer what the user needs to do.",
"est_finish": "0001-01-01T00:00:00.0000000",
"est_hrs": 0,
"est_hrs_remaining": 0,
"est_start": "0001-01-01T00:00:00.0000000",
"folder_id": 0,
"import_id": 0,
"nbr_events": 0,
"nbr_files": 0,
"nbr_notes": 0,
"nbr_tasks": 0,
"opened_by": 0,
"opened_by_company": "EDGB",
"opened_by_email": "[email protected]",
"opened_by_name": "Smith, John",
"original_id": 0,
"owner_name": "Smith, John",
"owner_user_id": 25264,
"pct_complete": 0,
"priority_code": "2-Fix Soon",
"project_id": 11873,
"resolved_by": 0,
"severity_code": " ",
"update_user_id": 25264,
"user_name": "Smith, John"
}
See Also
QAComplete REST API
/projects/{ProjectId}/defects/{Id} (PATCH)
/projects/{ProjectId}/defects/{Id} (PUT)