How to add file attribute in request body? - apiblueprint

I'm trying to document API through apiary.io and I want to add the following request body where there is a file in the form of key-value pair:
How can I add this file in request body in apiary?

Related

Nifi get post body params as attributes

I used HandleHttpRequest and can handle POST and GET methods. I used a AttributesToJson processor after it and I need to get POST body parameters as an attribute to include in the second processor. With GET everything is ok since the parameters already existed in http.header.xxx attribute.
Is there any way to extract POST body parameters as attributes?
EDIT-1:
post body example:
m1=7b45336b-48d2-4339-bb96-14610733df7d&ht=1655125815&on=185fcb1d55c40a6dccd68852202d9417&lp=418cb87b-47aa-4f59-817f-d227dabe7219&...
I can see the HandleHttpRequest processor has Parameters to Attributes List which say it creates a comma-separated parameters or form-data as attribute. But it just works for GET parameters not POST body.

How can we pass nested requested body which contains file in postman

I have two model files in java spring boot where in one i have declared the variables for database and another one to include file in Request body itself.
I have a controller which takes the request body this. How can i send the following request in postman. Is there better way of doing including a file and my other model class rather than just passing it as request param.
public String saveReferenceData(#RequestBody TestClass testClass){
// custom logic written
return "done";
You should use multipart request for handling files and text data. Multipart request is similar to any other payload but defined boundaries for server to handle and parse.
To Upload multipart file In postman:
Switch to body tab
select form-data
add keys
Alternative solution
Dothttp is similar tool with great control over these.
For Multipart upload
POST https://req.dothttp.dev
// selects as multipart
multipart(
'name'< 'john',
'photo'< 'C:\Users\john\documents\photo.jpg',
// and many more
)

Name of attribute for “Put Response Body In Attribute” in invokeHTTP

I have a endpoint would return response as follow.
{
"result": [
{},
....
{}]
}
I am trying to use invokeHTTP and enable “Put Response Body In Attribute” to keep origin flowfile and response from api.
but it seems add a attribute named $.result as follow
Is there any way to set a proper name for result attribute ? Thanks.
You try to extract results using a JSON path. However this is not possible from within InvokeHttp. You may want to use EvaluateJsonPath processor.
Documentation for Put Response Body In Attribute:
If set, the response body received back will be put into an attribute
of the original FlowFile instead of a separate FlowFile. The attribute
key to put to is determined by evaluating value of this property.
To keep the original flow file after calling InvokeHttp, you can move it to an attribute (if the content is small enough) just before calling InvokeHttp or you can use MergeContent with original flow file and response flow file from InvokeHttp.

What is the difference between parameters and body data in HTTP request in Jmeter?

i am unable to provide request to the server in json format using parameters so please can anyone explain me about it?
I sent this request from Bodydata extracting data from CSV:
POST data:
{
"password":"login",
"username":"568592"
}
but when i used parameters for extracting data from CSV:
POST data:
password=login&username=568592
How can i send json format request using parameters?
There should be no difference given you properly pass your JSON via "Parameters" section.
If you want to use "Parameters" - just put your JSON payload into "Value" section of the 1st parameter like:
If you want to use "Body Data" - put your JSON Payload there (don't forget to remove everything from the "Parameters" section)
Don't forget to add HTTP Header Manager to send Content-Type header with the value of application/json

How to pass post method response value through another post method request value

In Jmeter, how to use AUTH “access_token” for passing through header for another POST request ? Below are the step that i have done but it's not working ... How to use "access_token" value, that will use another post request dinamically ? Attached issues is here...
enter image description here
You need to add jp#gc-JSON Path Extractor in HTTP request, the particular HTTP request which is generating access token in its response data .
If response is like - {"access_token":"f5b06970-f00f-4b44-89c8-305738e19cba"}
In JSON path extractor add
Variable name - access_token (variable in which access_token will be stored)
2.JSON Expression - $.access_token (this will varry according to json response)
3.Default Value - NOT_FOUND
Now the next step is to use this variable named "access_token ". You can use it in your HTTP request for which you need to pass access token under HTTP header manager as access_token = ${access_token }
below link will help you a lot:
https://www.blazemeter.com/blog/advanced-usage-json-path-extractor-jmeter

Resources