Updates a comment. This example updates comment (id=10019) for the issue with key = "SCRUM-15".
curl --request PUT --user jira@example.com:JIRA_API_TOKEN \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '
{
"body": "ABC Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
"visibility": {
"type": "role",
"value": "Administrators"
}
}' \
--url 'https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/comment/10019'
#include <CkRestW.h>
#include <CkJsonObjectW.h>
#include <CkStringBuilderW.h>
void ChilkatSample(void)
{
CkRestW rest;
bool success;
// URL: https://your-domain.atlassian.net/rest/api/2/issue/SCRUM-15/comment/10019
bool bTls = true;
int port = 443;
bool bAutoReconnect = true;
success = rest.Connect(L"your-domain.atlassian.net",port,bTls,bAutoReconnect);
if (success != true) {
wprintf(L"ConnectFailReason: %d\n",rest.get_ConnectFailReason());
wprintf(L"%s\n",rest.lastErrorText());
return;
}
rest.SetAuthBasic(L"jira@example.com",L"JIRA_API_TOKEN");
CkJsonObjectW json;
json.UpdateString(L"body",L"ABC Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.");
json.UpdateString(L"visibility.type",L"role");
json.UpdateString(L"visibility.value",L"Administrators");
rest.AddHeader(L"Content-Type",L"application/json");
rest.AddHeader(L"Accept",L"application/json");
CkStringBuilderW sbRequestBody;
json.EmitSb(sbRequestBody);
CkStringBuilderW sbResponseBody;
success = rest.FullRequestSb(L"PUT",L"/rest/api/2/issue/SCRUM-15/comment/10019",sbRequestBody,sbResponseBody);
if (success != true) {
wprintf(L"%s\n",rest.lastErrorText());
return;
}
int respStatusCode = rest.get_ResponseStatusCode();
if (respStatusCode >= 400) {
wprintf(L"Response Status Code = %d\n",respStatusCode);
wprintf(L"Response Header:\n");
wprintf(L"%s\n",rest.responseHeader());
wprintf(L"Response Body:\n");
wprintf(L"%s\n",sbResponseBody.getAsString());
return;
}
CkJsonObjectW jsonResponse;
jsonResponse.LoadSb(sbResponseBody);
const wchar_t *self = 0;
const wchar_t *id = 0;
const wchar_t *authorSelf = 0;
const wchar_t *authorName = 0;
const wchar_t *authorKey = 0;
const wchar_t *authorAccountId = 0;
const wchar_t *authorEmailAddress = 0;
const wchar_t *authorAvatarUrls48x48 = 0;
const wchar_t *authorAvatarUrls24x24 = 0;
const wchar_t *authorAvatarUrls16x16 = 0;
const wchar_t *authorAvatarUrls32x32 = 0;
const wchar_t *authorDisplayName = 0;
bool authorActive;
const wchar_t *authorTimeZone = 0;
const wchar_t *body = 0;
const wchar_t *updateAuthorSelf = 0;
const wchar_t *updateAuthorName = 0;
const wchar_t *updateAuthorKey = 0;
const wchar_t *updateAuthorAccountId = 0;
const wchar_t *updateAuthorEmailAddress = 0;
const wchar_t *updateAuthorAvatarUrls48x48 = 0;
const wchar_t *updateAuthorAvatarUrls24x24 = 0;
const wchar_t *updateAuthorAvatarUrls16x16 = 0;
const wchar_t *updateAuthorAvatarUrls32x32 = 0;
const wchar_t *updateAuthorDisplayName = 0;
bool updateAuthorActive;
const wchar_t *updateAuthorTimeZone = 0;
const wchar_t *created = 0;
const wchar_t *updated = 0;
const wchar_t *visibilityType = 0;
const wchar_t *visibilityValue = 0;
self = jsonResponse.stringOf(L"self");
id = jsonResponse.stringOf(L"id");
authorSelf = jsonResponse.stringOf(L"author.self");
authorName = jsonResponse.stringOf(L"author.name");
authorKey = jsonResponse.stringOf(L"author.key");
authorAccountId = jsonResponse.stringOf(L"author.accountId");
authorEmailAddress = jsonResponse.stringOf(L"author.emailAddress");
authorAvatarUrls48x48 = jsonResponse.stringOf(L"author.avatarUrls.48x48");
authorAvatarUrls24x24 = jsonResponse.stringOf(L"author.avatarUrls.24x24");
authorAvatarUrls16x16 = jsonResponse.stringOf(L"author.avatarUrls.16x16");
authorAvatarUrls32x32 = jsonResponse.stringOf(L"author.avatarUrls.32x32");
authorDisplayName = jsonResponse.stringOf(L"author.displayName");
authorActive = jsonResponse.BoolOf(L"author.active");
authorTimeZone = jsonResponse.stringOf(L"author.timeZone");
body = jsonResponse.stringOf(L"body");
updateAuthorSelf = jsonResponse.stringOf(L"updateAuthor.self");
updateAuthorName = jsonResponse.stringOf(L"updateAuthor.name");
updateAuthorKey = jsonResponse.stringOf(L"updateAuthor.key");
updateAuthorAccountId = jsonResponse.stringOf(L"updateAuthor.accountId");
updateAuthorEmailAddress = jsonResponse.stringOf(L"updateAuthor.emailAddress");
updateAuthorAvatarUrls48x48 = jsonResponse.stringOf(L"updateAuthor.avatarUrls.48x48");
updateAuthorAvatarUrls24x24 = jsonResponse.stringOf(L"updateAuthor.avatarUrls.24x24");
updateAuthorAvatarUrls16x16 = jsonResponse.stringOf(L"updateAuthor.avatarUrls.16x16");
updateAuthorAvatarUrls32x32 = jsonResponse.stringOf(L"updateAuthor.avatarUrls.32x32");
updateAuthorDisplayName = jsonResponse.stringOf(L"updateAuthor.displayName");
updateAuthorActive = jsonResponse.BoolOf(L"updateAuthor.active");
updateAuthorTimeZone = jsonResponse.stringOf(L"updateAuthor.timeZone");
created = jsonResponse.stringOf(L"created");
updated = jsonResponse.stringOf(L"updated");
visibilityType = jsonResponse.stringOf(L"visibility.type");
visibilityValue = jsonResponse.stringOf(L"visibility.value");
}
{
"self": "https://chilkat.atlassian.net/rest/api/2/issue/10014/comment/10019",
"id": "10019",
"author": {
"self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
"emailAddress": "admin@chilkatsoft.com",
"avatarUrls": {
"48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
"24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
"16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
"32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
},
"displayName": "Chilkat Admin",
"active": true,
"timeZone": "America/Chicago"
},
"body": "ABC Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eget venenatis elit. Duis eu justo eget augue iaculis fermentum. Sed semper quam laoreet nisi egestas at posuere augue semper.",
"updateAuthor": {
"self": "https://chilkat.atlassian.net/rest/api/2/user?username=admin",
"name": "admin",
"key": "admin",
"accountId": "557058:be8b47b5-3bc0-43f6-b6b2-2cca0de12204",
"emailAddress": "admin@chilkatsoft.com",
"avatarUrls": {
"48x48": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=48&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D48%26noRedirect%3Dtrue",
"24x24": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=24&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D24%26noRedirect%3Dtrue",
"16x16": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=16&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D16%26noRedirect%3Dtrue",
"32x32": "https://avatar-cdn.atlassian.com/16d54dcc6d4bef86fd7ee62a7cf6334a?s=32&d=https%3A%2F%2Fsecure.gravatar.com%2Favatar%2F16d54dcc6d4bef86fd7ee62a7cf6334a%3Fd%3Dmm%26s%3D32%26noRedirect%3Dtrue"
},
"displayName": "Chilkat Admin",
"active": true,
"timeZone": "America/Chicago"
},
"created": "2018-04-14T10:14:41.741-0500",
"updated": "2018-04-14T10:25:07.558-0500",
"visibility": {
"type": "role",
"value": "Administrators"
}
}