Custom validation for Jira REST API

Hello!

I’m trying to integrate a third-party tool with Jira server via REST API.
Basically all I need is to be able to create an issue of a given type, get response (success/error) and get metadata (list of required and optional fields) for that tool via REST API.

The problem is I can’t use Jira REST API directly because it creates issues without taking in account business rules of a given issue type - e.g. requires fields, one fields can have values depending on another filed’s value, an attachment is a required as part of an issue etc

So, what is the best way to achieve this - create some “proxy” API, which will make all validation logic and call Jira native API, or is there any better solution?
Or I can customize Jira API - add my specific validation rules and create issue/reject request afterwards.

Thanks!

Jira has the concept of Required Fields (including requiring an attachment), Cascading Select fields, and input Validators.

  • If you need to have Jira list specific fields as fillable/enterable, add the fields to a screen for that project/issue type mapping.
  • If they need to be required fields (notnull), then add them to a field configuration for that project/issue type mapping.
  • If you need to have dependent values, use a Cascading Select, so you can have a Parent field and a Child field.
  • If you need to require an Attachment, then add that to a field configuration for that project/issue type mapping.
  • If you need to validate input, use an out of the box validator, a plugin validator, or write your own validation class.

You can use the issue endpoint to create, update, get, and delete issues. You can use the createMeta and editMeta endpoints to discover what fields are available and required.

Hello sfbehnke,

Thank you for the detailed reply.

Currently we have a separate screen for a given issue type (create/edit), but the validation logic is “smashed” between some Javascript code, Behaviours and SIL Programs Manager add-ons, AJS scripts, Jira native fields configuration etc (yeah, it’s some legacy customized Jira used by our client). And I want to be sure if someone will try to create an issue via REST API, the data is consistent according to the issue business rules.

So, basically if I want to create issue with a given type via REST API, I have to define a new screen for it, set all required fields via standard Jira settings, set Cascading fields rules and the standard validator will check if everything is ok out-of-the box?

Sorry, I’m new to Jira and not sure if my current understanding is correct now.

Thanks

Serverside logic will still work. Client side logic will not. Any enforcement or validation done with Behaviors or AJS/Javascript should be enforced serverside instead.