(Unicode C) Download a Jira Attachment
Demonstrates how to download a Jira attachment to a file.
#include <C_CkHttpW.h>
void ChilkatSample(void)
{
HCkHttpW http;
const wchar_t *url;
const wchar_t *localFilePath;
BOOL success;
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http = CkHttpW_Create();
CkHttpW_putFollowRedirects(http,TRUE);
// Provide the username/password for authentication
CkHttpW_putLogin(http,L"jira@example.com");
CkHttpW_putPassword(http,L"JIRA_API_TOKEN");
// The URL for a Jira attachment has this format:
// https://your-domain.atlassian.net/secure/attachment/{attachment_id}/{attachment_filename}
url = L"https://chilkat.atlassian.net/secure/attachment/10001/starfish.jpg";
localFilePath = L"qa_output/starfish.jpg";
success = CkHttpW_Download(http,url,localFilePath);
if (success != TRUE) {
wprintf(L"%s\n",CkHttpW_lastErrorText(http));
CkHttpW_Dispose(http);
return;
}
wprintf(L"Successfully downloaded Jira attachment.\n");
CkHttpW_Dispose(http);
}
|