...
This API fetches text data from the machine on which this utility is installed. The API format is
POSTGET <BASE_URL>/file
and accepts a single body query parameter "filePath" and its value is the absolute file path which you want to fetch from your system.system.
How to use this API:
Assuming that vutil is running on port 4080 and vutil base URL is "http://localhost:4080".
Suppose we have a sample JSON file sample.json stored in directory path {{dataDir}}/jsons/sample.json.
Now we will try to fetch this JSON file by using the following API.
Now set the request query parameter "filePath" as follows:
And the API will produce the file content as output:
Code Block | ||||
---|---|---|---|---|
| ||||
[
{
"request": {
"body": {
"name": "",
"email": "john.doe@example.com",
"designation": "Chief Technical Officer",
"organization": "example.com",
"country": "India",
"aboutMe": "Please write something about me...",
"twitterId": "fake.john.doe",
"facebookId": "fake.john.doe",
"githubId": "fake.john.doe",
"createdOn": "2014-05-03T06:28:45.479Z"
}
},
"response": {
"expectedBody": "{\"errors\": { \"name\": \"required field\"}}",
"statusCode": "400"
}
},
{
"request": {
"body": {
"name": "Sample Name whose length is greater than the limit",
"email": "john.doe@example.com",
"designation": "Chief Technical Officer",
"organization": "example.com",
"country": "India",
"aboutMe": "Please write something about me...",
"twitterId": "fake.john.doe",
"facebookId": "fake.john.doe",
"githubId": "fake.john.doe",
"createdOn": "2014-05-03T06:28:45.479Z"
}
},
"response": {
"expectedBody": "{\"errors\": { \"name\": \"field length cannot be greater than 35\"}}",
"statusCode": "400"
}
},
{
"request": {
"body": {
"name": "John Doe",
"email": "john.doe@example.com",
"designation": "Sample designation whose length is greater than the limit",
"organization": "example.com",
"country": "India",
"aboutMe": "Please write something about me...",
"twitterId": "fake.john.doe",
"facebookId": "fake.john.doe",
"githubId": "fake.john.doe",
"createdOn": "2014-05-03T06:28:45.479Z"
}
},
"response": {
"expectedBody": "{\"errors\": { \"designation\": \"field length cannot be greater than 35\"}}",
"statusCode": "400"
}
},
{
"request": {
"body": {
"name": "John Doe",
"email": "john.doe@example.com",
"designation": "Chief Technical Officer",
"organization": "Sample organization whose length is greater than the limit",
"country": "India",
"aboutMe": "Please write something about me...",
"twitterId": "fake.john.doe",
"facebookId": "fake.john.doe",
"githubId": "fake.john.doe",
"createdOn": "2014-05-03T06:28:45.479Z"
}
},
"response": {
"expectedBody": "{\"errors\": { \"organization\": \"field length cannot be greater than 35\"}}",
"statusCode": "400"
}
},
{
"request": {
"body": {
"name": "John Doe",
"email": "john.doe@example.com",
"designation": "Chief Technical Officer",
"organization": "example.com",
"country": "Sample country name whose length is greater than the limit",
"aboutMe": "Please write something about me...",
"twitterId": "fake.john.doe",
"facebookId": "fake.john.doe",
"githubId": "fake.john.doe",
"createdOn": "2014-05-03T06:28:45.479Z"
}
},
"response": {
"expectedBody": "{\"errors\": { \"country\": \"field length cannot be greater than 35\"}}",
"statusCode": "400"
}
},
{
"request": {
"body": {
"name": "John Doe",
"email": "john.doe@example.com",
"designation": "Chief Technical Officer",
"organization": "example.com",
"country": "India",
"aboutMe": "[Updated] Please write something about me...",
"twitterId": "fake.john.doe",
"facebookId": "fake.john.doe",
"githubId": "fake.john.doe",
"createdOn": "2014-05-03T06:28:45.479Z"
}
},
"response": {
"expectedBody": "{\"name\": \"John Doe\",\"email\": \"john.doe@example.com\",\"designation\": \"Chief Technical Officer\",\"organization\": \"example.com\",\"country\": \"India\",\"aboutMe\": \"[Updated] Please write something about me...\",\"twitterId\": \"fake.john.doe\",\"facebookId\": \"fake.john.doe\",\"githubId\": \"fake.john.doe\",\"createdOn\": \"{{*}}\"}",
"statusCode": "200"
}
}
] |
That's it.