How to fetch required fields from api v3 with values that can be set?

I am creating an issue using the /rest/api/3/issue api. This is successful for projects/types where there are no required fields. What is the process for creating an issue via the api when the required fields are not known? How can the required fields be fetched along with the values that can be set? Ideally there would be an option in the api to automatically set required fields to the first value or with a placeholder. If that doesn’t exist what endpoint should be used to fetch required fields and their values?

Welcome to the Atlassian developer community @ajeetd,

I think these are the endpoints you’re looking for:

2 Likes

Thank you. I have tested this by setting a field to required (labels in my case) and using these endpoints, I do not see labels returned in the response. I can confirm labels is set to required because when I attempt to create an issue without it, I correctly get an error response indicating labels is required.

@ajeetd,

Sounds like a bug. You should report those through developer support.

Hello @ajeetd

You said “I do not see labels returned in the response”. Setting a field to be required has no effect on whether or not it will be ‘seen’ (returned) in the response from using via the Get create field metadata for a project and issue type id endpoint, it only changes the value of the required parameter in the response, here:

If you are not getting the label field back in the response at all, then you are doing something else wrong, such as:

  1. Querying against the wrong issue type or the wrong project
  2. Don’t have the labels field on the create screen of that issue type

Also, you haven’t said HOW you are making these requests or what other API tools or methods you’re using to cross-check that it’s not a basic coding mistake.

I strongly suggest you have a peer review your work to double-check what you’ve done.

I believe I was looking at the wrong response earlier. I do see the response in the format outlined above now and labels is present and required is correctly set to true.

This resolves the question asked. Next steps is understanding what automated issue creation can actually do about required fields without human intervention by setting some sort of default value.