liki7411Occasional ContributorJoined 4 years ago5 Posts2 LikesLikes received1 SolutionView All Badges
ContributionsMost RecentMost LikesSolutionsSent jpg as byte array I want to send an image which is in local file as byte array. I am trying to post an image -(jpg format) with the request , I have tried the media type as - mixed/form-data/ and url-encoded too, but i see the tool trying to post as base64 as below, <img src="data:image/jpeg;base64,/9j/..values..../2Q==" alt=""/>. Also i have written groovy script to convert from base64 to byte array.Let me know if its incorrect. import org.apache.commons.io.FileUtils import java.util.* //import org.apache.commons.codec.binary.Base64 byte[] fileContent = FileUtils.readFileToByteArray(new File('C:/Users/likith.n/Documents/Test.jpg')); String encodedString = Base64.getEncoder().encodeToString(fileContent); return encodedString Also please let me know how to send it in byte array and mention the media type to send. Re: Trim the node value Thanks a lot !! Trim the node value I am using a POST method in ReadyAPI the response is as follows, <target_URL>: "http:/<servername>:port/k?key=abcdfee= <httpmethod>GET</httpmethod> <targetpayload null="true"/> <isKBANeeded>true</isKBANeeded> Issue 1: Unable to trim only the key value(in red) in target_URL Issue 2: How to use the fetched key as parameter in other API's as header? Steps performed: - I need the key value (in red) from target_URL to pass as parameter to the next API. Created the propertyTransfer and assigned the value to a variable. But unable to use the value in header for other API. SolvedRe: Getting 404 on API call There was an extra key word appending in endpoint URL. Thank you Getting 404 on API call I am sending a token value in response body of POST method. type is JSON , method is POST Sample body : { "newGuid": "token value" } Still getting "HTTP/1.1 404 Not Found Server: Kestrel ". Same steps are absolutely working on other API plugins. Solved