Robot Framework for APIs v2019
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Using Robot Framework for API (test) automation
Base URLs:
Default
get__users
Code samples
# You can also use wget
curl -X GET https://jsonplaceholder.typicode.com/users \
-H 'Accept: application/json'
GET https://jsonplaceholder.typicode.com/users HTTP/1.1
Host: jsonplaceholder.typicode.com
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('https://jsonplaceholder.typicode.com/users',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://jsonplaceholder.typicode.com/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://jsonplaceholder.typicode.com/users', params={
}, headers = headers)
print r.json()
'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://jsonplaceholder.typicode.com/users', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://jsonplaceholder.typicode.com/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://jsonplaceholder.typicode.com/users", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /users
Get all users
This endpoint returns all the existing users. The longer description goes in this field.
Example responses
200 Response
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
]
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | GET all | users |
post__users
Code samples
# You can also use wget
curl -X POST https://jsonplaceholder.typicode.com/users \
-H 'Accept: application/json'
POST https://jsonplaceholder.typicode.com/users HTTP/1.1
Host: jsonplaceholder.typicode.com
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('https://jsonplaceholder.typicode.com/users',
{
method: 'POST',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.post 'https://jsonplaceholder.typicode.com/users',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.post('https://jsonplaceholder.typicode.com/users', params={
}, headers = headers)
print r.json()
'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','https://jsonplaceholder.typicode.com/users', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://jsonplaceholder.typicode.com/users");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "https://jsonplaceholder.typicode.com/users", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
POST /users
Create new user
This endpoint creates a new user
Example responses
201 Response
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
201 | Created | POST valid | user |
get__users_{id}
Code samples
# You can also use wget
curl -X GET https://jsonplaceholder.typicode.com/users/{id} \
-H 'Accept: application/json'
GET https://jsonplaceholder.typicode.com/users/{id} HTTP/1.1
Host: jsonplaceholder.typicode.com
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('https://jsonplaceholder.typicode.com/users/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.get 'https://jsonplaceholder.typicode.com/users/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.get('https://jsonplaceholder.typicode.com/users/{id}', params={
}, headers = headers)
print r.json()
'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','https://jsonplaceholder.typicode.com/users/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://jsonplaceholder.typicode.com/users/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "https://jsonplaceholder.typicode.com/users/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
GET /users/{id}
Get the user
This endpoint returns the existing user. And I am Mr Longer Description you could not fit in the summary.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | id of the user |
Example responses
200 Response
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | GET single | user |
put__users_{id}
Code samples
# You can also use wget
curl -X PUT https://jsonplaceholder.typicode.com/users/{id} \
-H 'Accept: application/json'
PUT https://jsonplaceholder.typicode.com/users/{id} HTTP/1.1
Host: jsonplaceholder.typicode.com
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('https://jsonplaceholder.typicode.com/users/{id}',
{
method: 'PUT',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.put 'https://jsonplaceholder.typicode.com/users/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.put('https://jsonplaceholder.typicode.com/users/{id}', params={
}, headers = headers)
print r.json()
'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','https://jsonplaceholder.typicode.com/users/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://jsonplaceholder.typicode.com/users/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "https://jsonplaceholder.typicode.com/users/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PUT /users/{id}
Update the user
This endpoint updates the existing user. I can use this field to explain e.g. internals. Am freeform text.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | id of the user |
Example responses
200 Response
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | PUT single | user |
delete__users_{id}
Code samples
# You can also use wget
curl -X DELETE https://jsonplaceholder.typicode.com/users/{id} \
-H 'Accept: application/json'
DELETE https://jsonplaceholder.typicode.com/users/{id} HTTP/1.1
Host: jsonplaceholder.typicode.com
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('https://jsonplaceholder.typicode.com/users/{id}',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.delete 'https://jsonplaceholder.typicode.com/users/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.delete('https://jsonplaceholder.typicode.com/users/{id}', params={
}, headers = headers)
print r.json()
'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','https://jsonplaceholder.typicode.com/users/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://jsonplaceholder.typicode.com/users/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "https://jsonplaceholder.typicode.com/users/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
DELETE /users/{id}
Delete the user
This endpoint deletes the existing user.
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | id of the user |
Example responses
200 Response
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | DELETE single | user |
patch__users_{id}
Code samples
# You can also use wget
curl -X PATCH https://jsonplaceholder.typicode.com/users/{id} \
-H 'Accept: application/json'
PATCH https://jsonplaceholder.typicode.com/users/{id} HTTP/1.1
Host: jsonplaceholder.typicode.com
Accept: application/json
const headers = {
'Accept':'application/json'
};
fetch('https://jsonplaceholder.typicode.com/users/{id}',
{
method: 'PATCH',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});
require 'rest-client'
require 'json'
headers = {
'Accept' => 'application/json'
}
result = RestClient.patch 'https://jsonplaceholder.typicode.com/users/{id}',
params: {
}, headers: headers
p JSON.parse(result)
import requests
headers = {
'Accept': 'application/json'
}
r = requests.patch('https://jsonplaceholder.typicode.com/users/{id}', params={
}, headers = headers)
print r.json()
'application/json',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PATCH','https://jsonplaceholder.typicode.com/users/{id}', array(
'headers' => $headers,
'json' => $request_body,
)
);
print_r($response->getBody()->getContents());
}
catch (\GuzzleHttp\Exception\BadResponseException $e) {
// handle exception or api errors.
print_r($e->getMessage());
}
// ...
URL obj = new URL("https://jsonplaceholder.typicode.com/users/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
response.append(inputLine);
}
in.close();
System.out.println(response.toString());
package main
import (
"bytes"
"net/http"
)
func main() {
headers := map[string][]string{
"Accept": []string{"application/json"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PATCH", "https://jsonplaceholder.typicode.com/users/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}
PATCH /users/{id}
Patch the user
Note that as a PATCH I can only update the user's one property!
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
id | path | integer | true | id of the user |
Example responses
200 Response
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
Responses
Status | Meaning | Description | Schema |
---|---|---|---|
200 | OK | PATCH single | user |
Schemas
users
[
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
]
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
anonymous | [user] | false | none | none |
user
{
"id": 1,
"name": "Leanne Graham",
"username": "Bret",
"email": "Sincere@april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
},
"phone": "1-770-736-8031 x56442",
"website": "hildegard.org",
"company": {
"name": "Romaguera-Crona",
"catchPhrase": "Multi-layered client-server neural-net",
"bs": "harness real-time e-markets"
}
}
Properties
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
id | integer | false | none | none |
name | string | false | none | none |
username | string | false | none | none |
string(email) | false | none | none | |
address | object | false | none | none |
» street | string | true | none | none |
» suite | string | true | none | none |
» city | string | true | none | none |
» zipcode | string | true | none | none |
» geo | object | true | none | none |
»» lat | string | true | none | none |
»» lng | string | true | none | none |
» phone | string | false | none | none |
» website | string | false | none | none |
» company | object | false | none | none |
»» name | string | true | none | none |
»» catchPhrase | string | true | none | none |
»» bs | string | true | none | none |