cancel
Showing results for 
Search instead for 
Did you mean: 

Create a new test case via API

SOLVED
apuna12
Occasional Contributor

Create a new test case via API

Hello all,

 

I would like to ask how can I create Test or any kind of issue through Zephyr's API. I was able to create test cycle through

the following API https://zfjcloud.docs.apiary.io/#reference/cycle 

 

I did not find the way to create an issue or more specifically test case via API. I would really appreciate a tip how to configure headers and body too.

 

Can you please help me with this?

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Create a new test case via API

Hi @apuna12 


 https://my-jira.atlassian.net/rest/api/3/issue ? this endpoint is correct, since this is JIRA Api call and for create cycle its zephyr operation so end point for zephyr api's is different

As per screenshot error I can see that you are using jira password as password field in basic authentication. In jira you can't use password in basic authentication, you have to use JIRA Api key value as password field. 

 

Follow below steps to generate your JIRA Api key:

1. Click on user profile

2. Navigate to manage account

3. Click on security 

3. Create and manage api tokens


or directly navigate to url : https://id.atlassian.com/manage-profile/security/api-tokens
and create api token

Once you generated the api token >> copy the api token value and use it as your password field in postman basic authentication and try again

 

Thanks

Jagadeesh

 

View solution in original post

4 REPLIES 4

Re: Create a new test case via API

Hi

Creating TestCase is nothing but creating the issue in jira, this is JIRA Api call, you can follow JIRA Api documentation and create test cases

https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-p...

 

Thanks

Jagadeesh

apuna12
Occasional Contributor

Re: Create a new test case via API

Hello @JagadeshMadhura 

 

I tried the link you posted. I copied the request body, added the headers which are used in the page, used basic authentication but I am still getting an error. Can you please help me figure out where is the problem?

 

apuna12_0-1613560831320.pngapuna12_1-1613560890104.png

And in the body I have the body from the page you posted (Except I used my profile ID). Last time I used the following API to create a cycle

https://prod-api.zephyr4jiracloud.com/connect/public/rest/api/1.0/cycle

 

This time I am using https://my-jira.atlassian.net/rest/api/3/issue ? Is this OK? Seems weird to me.

 

Thanks,

Tibor

Re: Create a new test case via API

Hi @apuna12 


 https://my-jira.atlassian.net/rest/api/3/issue ? this endpoint is correct, since this is JIRA Api call and for create cycle its zephyr operation so end point for zephyr api's is different

As per screenshot error I can see that you are using jira password as password field in basic authentication. In jira you can't use password in basic authentication, you have to use JIRA Api key value as password field. 

 

Follow below steps to generate your JIRA Api key:

1. Click on user profile

2. Navigate to manage account

3. Click on security 

3. Create and manage api tokens


or directly navigate to url : https://id.atlassian.com/manage-profile/security/api-tokens
and create api token

Once you generated the api token >> copy the api token value and use it as your password field in postman basic authentication and try again

 

Thanks

Jagadeesh

 

View solution in original post

apuna12
Occasional Contributor

Re: Create a new test case via API

That worked! 🙂

 

Thanks,

 

You are awesome.

 

Have a nice day 🙂 

New Here?
Join us and watch the welcome video: