简体   繁体   中英

How to request Rest API eclipse service in postman?

I generate this Rest API service in java eclipse, now i am not sure how to test this in Postman.

So can anyone guide me on how the @QueryParam json object will be written in postman?

@Path("/UpdateTenantProfile")
public class UpdateTenantProfile {

    @SuppressWarnings({ "unchecked" })
    @POST
    @Path("UpdateTenantProfiledetails")
    @Produces("application/json")
    @Consumes("application/json")

    public String UpdateTenantProfilem(@QueryParam("profileDetail") JSONObject profileDetail) throws JSONException {

        Connection dbConnection = null;
        Statement stmt = null;
        JSONObject jsarr = new JSONObject();

        try {

            // con.setAutoCommit(false);

            dbConnection = DBConnection.getDBConnection();

            dbConnection.setAutoCommit(false);
            stmt = (Statement) dbConnection.createStatement();
            // System.out.println("Iam entering try catch bloxck");

            // System.out.println("length of json data"+kcm.length());

                String PIDNO = profileDetail.getString("PIDNO");
                String GENDER = profileDetail.getString("GENDER");
                String TENANTNAME = profileDetail.getString("TENANTNAME");
                String EMAIL = profileDetail.getString("EMAIL");
                String OFFPHONE = profileDetail.getString("OFFPHONE");
                String MOBILE = profileDetail.getString("MOBILE");

Either it's inside url, body or form data I don't have idea about it,

You can give encoded Query Param in the Postman Inside Params tab near Auth Tab as shown below.

You can do encoding of data from https://www.url-encode-decode.com/

在此处输入图像描述 在此处输入图像描述

Edit:

As you can see I got a perfect response from API. I returned the Value of JSON from API.

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM