Attach chart.js image to JetBrains Space POST request

27 views Asked by At

I'm struggling to find any resources for creating an issue in JetBrain's Space docs.

This is what I'm working with, mostly from their API playground:

function createIssue(apiData) {
        const { url, auth, title, description, assignee, status, imageData, customFields } = apiData;
        window.fetch(`${url}`, {
            method: 'POST',
            headers: {
                Authorization: `Bearer ${auth}`,
                Accept: 'application/json',
                'Content-Type': 'application/json',
            },
            body: JSON.stringify({
                title: `${title}`,
                description: `${description}`,
                assignee: `${assignee}`,
                status: `${status}`,
                attachments: [
                    // image data here?
                ],
                    customFields: [
                {
                    fieldId: `${customFields[0].fieldId}`,
                    value: {
                        className: `${customFields[0].value.className}`,
                    },
                },
            ],
        }),
    });
}

api.imageData is currently being initialized with .toBase68Image('image/png', 1)

Given that this a data url, how can I include this in my request as an attachment? Or is this an XY problem and there is a better approach to take?

0

There are 0 answers