1

JIRA JQL Search Query: post method with end point http://localhost:8080/rest/api/2/search

body:
{
    "jql":"project = QA and key=123",
    "startAt":0,
    "maxResults":1,
    "fields":[
        "id",
        "key",
        "custom_Field1"
        ]
}

above structure giving expected values for variables from fields array in postman

ISSUE :

REST API JAVA IMPLEMENTATION

For above structure POJO class been defined and while creating JSCON from POJO Class, variables from fields POJO class are ignored as they are not set by setter method. Due to this not getting desired output from response. How to convert POJO class to JSCON as per above structure.

Converted JSCON from POJO CLASS

{
 "jql":"project = QA and key=123",
 "startAt":0,
 "maxResults":1,
 "fields":[]
}

with this structure it is not returning value for custom_Field1

in Java Rest API POJO Class created as below

public root{
    private String jql;
    private int startAt;
    private int maxResults;
    private List<field> fields;
    
    public void setjql(String jql){
        this.jql=jql;
    }
    public String getjql(){
        return this.jql;
    }
    public void setstartAt(int startAt){
        this.startAt=startAt;
    }
    public int getstartAt(){
        return this.startAt;
    }
    public void setmaxResults(int maxResults){
        this.maxResults=maxResults;
    }
    public int getmaxResults(){
        return this.maxResults;
    }
    public void setfields(List<field> fields){
        this.fields=fields;
    }
    public List<fields> getfileds(){
        return this.fields;
    }
} 

public field{   
    private int id;
    private String key;
    private String custom_Field1;
    
    public void setID(int id){
        this.id=id;
    }
    public int getID(){
        return this.id;
    }
    public void setKey(String key){
        this.key=key;
    }
    public String getKey(){
        return this.key;
    }
    public void setcustom_Field1(String custom_Field1){
        this.custom_Field1=custom_Field1;
    }
    public String getcustom_Field1(){
        return this.custom_Field1;
    }

    
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.