Assigns the issue to the user. Use this resource to assign issues for the users having “Assign Issue” permission, and not having the “Edit Issue” permission. If name body parameter is set to “-1” then automatic issue assignee is used. A name set to null will remove the assignee. A successful response is indicated by a 204 status code with no response body. This example assigns issue "SCRUM-15" to "matt"
curl -X PUT --user jira@example.com:JIRA_API_TOKEN \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"name": "matt"
}' \
--url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/assignee'
#include <C_CkRestW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkStringBuilderW.h>
void ChilkatSample(void)
{
HCkRestW rest;
BOOL success;
BOOL bTls;
int port;
BOOL bAutoReconnect;
HCkJsonObjectW json;
HCkStringBuilderW sbRequestBody;
HCkStringBuilderW sbResponseBody;
int respStatusCode;
rest = CkRestW_Create();
// URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/assignee
bTls = TRUE;
port = 443;
bAutoReconnect = TRUE;
success = CkRestW_Connect(rest,L"your-domain.atlassian.net",port,bTls,bAutoReconnect);
if (success != TRUE) {
wprintf(L"ConnectFailReason: %d\n",CkRestW_getConnectFailReason(rest));
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
return;
}
CkRestW_SetAuthBasic(rest,L"jira@example.com",L"JIRA_API_TOKEN");
json = CkJsonObjectW_Create();
CkJsonObjectW_UpdateString(json,L"name",L"matt");
CkRestW_AddHeader(rest,L"Content-Type",L"application/json");
CkRestW_AddHeader(rest,L"Accept",L"application/json");
sbRequestBody = CkStringBuilderW_Create();
CkJsonObjectW_EmitSb(json,sbRequestBody);
sbResponseBody = CkStringBuilderW_Create();
success = CkRestW_FullRequestSb(rest,L"PUT",L"/rest/api/2/issue/SCRUM-15/assignee",sbRequestBody,sbResponseBody);
if (success != TRUE) {
wprintf(L"%s\n",CkRestW_lastErrorText(rest));
CkRestW_Dispose(rest);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
respStatusCode = CkRestW_getResponseStatusCode(rest);
if (respStatusCode >= 400) {
wprintf(L"Response Status Code = %d\n",respStatusCode);
wprintf(L"Response Header:\n");
wprintf(L"%s\n",CkRestW_responseHeader(rest));
wprintf(L"Response Body:\n");
wprintf(L"%s\n",CkStringBuilderW_getAsString(sbResponseBody));
CkRestW_Dispose(rest);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
return;
}
CkRestW_Dispose(rest);
CkJsonObjectW_Dispose(json);
CkStringBuilderW_Dispose(sbRequestBody);
CkStringBuilderW_Dispose(sbResponseBody);
}