Skip to content
This repository has been archived by the owner on Jul 23, 2020. It is now read-only.

createComponent -> Error 415 #191

Open
falcaosurfline-zz opened this issue Sep 18, 2019 · 3 comments
Open

createComponent -> Error 415 #191

falcaosurfline-zz opened this issue Sep 18, 2019 · 3 comments
Assignees
Labels

Comments

@falcaosurfline-zz
Copy link

Hi Guys
Could you share a example of code to create a component?
I trying to use JIRA schema and give error, while when using postman it works.

@falcaosurfline-zz
Copy link
Author

falcaosurfline-zz commented Sep 18, 2019

// ES5
var JiraClient = require('jira-connector');

// Initialize
var jira = new JiraClient({
host: "hostname.atlassian.net",
basic_auth: {
base64: "APIKEYxxxxxxxx"
}
});

async function run(){

const issue = await jira.component.createComponent(
{ name: 'mycomponent',
description: componentdescription',
leadUserName: 'user.name',
assigneeType: 'COMPONENT_LEAD',
isAssigneeTypeValid: false,
project: 'CNS',
projectId: 12800 });

console.log(issue);

};

run()

@kylefarris kylefarris self-assigned this Sep 19, 2019
@kylefarris
Copy link
Collaborator

@falcaosurfline You off by just a little bit. This would be the correct syntax:

// Initialize
var jira = new JiraClient({
    host: "hostname.atlassian.net",
    basic_auth: {
        base64: "APIKEYxxxxxxxx"
    }
});

async function run() {
    const issue = await jira.component.createComponent({
        component: { // <--- This is the missing part
            name: 'mycomponent',
            description: componentdescription',
            leadUserName: 'user.name',
            assigneeType: 'COMPONENT_LEAD',
            isAssigneeTypeValid: false,
            project: 'CNS',
            projectId: 12800,
        }
    });
    console.log(issue);
};

run()

Does that help?

@falcaosurfline-zz
Copy link
Author

Thanks guys!! Did work. Yeeewww

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants