Postman - Post Request api Details for uploading images
I am performing POST
request for uploading multiple images. Below is a Postman screenshot where everything works fine and I am getting the right response. But then I need to implement the same using RestAssured Program.
Above is the snapshot of the program which I tried but then I am not getting the 500
error don`t know what is missing what wrong I am doing here.
import io.restassured.RestAssured;
import io.restassured.response.Response;
import io.restassured.specification.RequestLogSpecification;
import io.restassured.response.Response;
import io.restassured.specification.RequestSpecification;
Class UploadImages_API {
RestAssured.baseURI = "http://azrvqmobfletap2.corp.ryder.com:86";
httpRequest = RestAssured.given().log().all();
String file1_new1 = System.getProperty("user.dir")+"\\src\\main\\resources\\ImageUpload\\1.jpg";
String file2_new2 = System.getProperty("user.dir")+"\\src\\main\\resources\\ImageUpload\\2.jpg";
String file3_new3 = System.getProperty("user.dir")+"\\src\\main\\resources\\ImageUpload\\3.jpg";
httpRequest.given()
.formParam("Year", "2008")
.formParam("make", "Ford")
.formParam("model", "Cascadia")
.formParam("angleTokens", "top,left,bottom")
.formParam("productCode", "485274")
.multiPart("pictureData","file1_new1")
.multiPart("pictureData","file2_new2")
.multiPart("pictureData","file3_new3");
response = httpRequest.post("/UsedTrucksInventory/api/Image/UploadImage");
System.out.println(" Response : "+response.asString());
}