Hi all, How do I post an image file on a JSON call? I tried to read the file into a string, but it would read all the way through. Here is my set up. JSON sample { "VehicleInfo" : { "vin" : "33333333333333333", "ImageInfo" : { "primary" : 0, "imageSetId" : 1428486722267, "caption" : "Inventory Photo", "imageSource" : "Mobile", "imageOrder" : 23, "postRecon" : 1, "imagedata" : "icKlaNk\/tL9UfG\/iDQNS8La\r\njNomsWht7i3k2NkHrzyMj0\/+vXM\/Zg7CeKM\/K2GI55PY\/wA6\/", "title" : "33333333333333333_1428486722267_ADESA_Inventory_label.jpg" } } } I use FOpen() to open the file, and use FRead() to read the file in to a string. Then use WebUrlPostBin() to send the file. I am getting the bad request error: {"message":"Could not read JSON: Invalid UTF-8 start byte 0xff\n at [Source: org.apache.catalina.connector.CoyoteInputStream@48254b0c; line: 11, column: 41] (through reference chain: com.adesa.dmm.rest.domain.VehicleUpload[\"VehicleInfo\"]- com.adesa.dmm.rest.domain.VehicleInfo[\"ImageInfo\"]- com.adesa.dmm.rest.domain.ImageInfo[\"imagedata\"]); nested exception is com.fasterxml.jackson.databind.JsonMappingException: Invalid UTF-8 start byte 0xff\n at [Source: org.apache.catalina.connector.CoyoteInputStream@48254b0c; line: 11, column: 41] (through reference chain: com.adesa.dmm.rest.domain.VehicleUpload[\"VehicleInfo\"]- com.adesa.dmm.rest.domain.VehicleInfo[\"ImageInfo\"]- com.adesa.dmm.rest.domain.ImageInfo[\"imagedata\"])","status":"BAD_REQUEST"} This is the out-hdr POST /api/uploadSingleImageForVin.json HTTP/1.1 Content-Type: application/json Host: test.autc.com Content-Length: 610 Connection: Keep-Alive Accept: application/json Accept-Encoding: gzip, deflate User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_1 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8G4+Safari/6533.18.5 Cookie: AtcServerLogin=ABZzc29zZXJ... This is my out data. Note the short string of "imagedata" { "VehicleInfo" : { "vin" : "2C4RDGBGXCR177180", "ImageInfo" : { "primary" : 0, "imageSetId" : 1429294956222, "caption" : "ADESA Inventory Label Photo", "imageSource" : "Mobile", "imageOrder" : 23, "postRecon" : 1, "imagedata" : "+Ø+à", "title" : "1429294956222_ADESA_Inventory_label.jpg" } } } Thanks, -Ronald
↧