Sample code for 30+ languages & platforms
C

Download a Jira Attachment

See more Jira Examples

Demonstrates how to download a Jira attachment to a file.

Chilkat C Downloads

C
#include <C_CkHttp.h>

void ChilkatSample(void)
    {
    BOOL success;
    HCkHttp http;
    const char *url;
    const char *localFilePath;

    success = FALSE;

    // This example requires the Chilkat API to have been previously unlocked.
    // See Global Unlock Sample for sample code.

    http = CkHttp_Create();

    CkHttp_putFollowRedirects(http,TRUE);

    // Provide the username/password for authentication
    CkHttp_putLogin(http,"jira@example.com");
    CkHttp_putPassword(http,"JIRA_API_TOKEN");

    // The URL for a Jira attachment has this format: 
    // https://your-domain.atlassian.net/secure/attachment/{attachment_id}/{attachment_filename}

    url = "https://chilkat.atlassian.net/secure/attachment/10001/starfish.jpg";
    localFilePath = "qa_output/starfish.jpg";
    success = CkHttp_Download(http,url,localFilePath);
    if (success != TRUE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        return;
    }

    printf("Successfully downloaded Jira attachment.\n");


    CkHttp_Dispose(http);

    }