Spring CRUD app made during Hyperskill Jetbrains Java Backend Developer Course
Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.
Base URLs:
Code samples
# You can also use wget
curl -X GET http://localhost:8881/api/recipe/{id} \
-H 'Accept: */*'
GET http://localhost:8881/api/recipe/{id} HTTP/1.1
Host: localhost:8881
Accept: */*
const headers = {
'Accept':'*/*'
};
fetch('http://localhost:8881/api/recipe/{id}',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Accept' => '*/*'
}
result = RestClient.get 'http://localhost:8881/api/recipe/{id}',
params: {
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Accept': '*/*'
}
r = requests.get('http://localhost:8881/api/recipe/{id}', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => '*/*',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8881/api/recipe/{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("http://localhost:8881/api/recipe/{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{"*/*"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8881/api/recipe/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}GET /api/recipe/{id}
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | integer(int64) | true | none |
Example responses
200 Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Recipe |
Code samples
# You can also use wget
curl -X PUT http://localhost:8881/api/recipe/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: */*'
PUT http://localhost:8881/api/recipe/{id} HTTP/1.1
Host: localhost:8881
Content-Type: application/json
Accept: */*
const inputBody = '{
"recipe": {
"name": "string",
"description": "string",
"ingredients": [
"string"
],
"directions": [
"string"
],
"category": "string",
"date": "2019-08-24T14:15:22Z"
},
"details": {
"username": "string",
"password": "string",
"enabled": true,
"authorities": [
{
"authority": "string"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch('http://localhost:8881/api/recipe/{id}',
{
method: 'PUT',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.put 'http://localhost:8881/api/recipe/{id}',
params: {
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.put('http://localhost:8881/api/recipe/{id}', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => '*/*',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('PUT','http://localhost:8881/api/recipe/{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("http://localhost:8881/api/recipe/{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{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("PUT", "http://localhost:8881/api/recipe/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}PUT /api/recipe/{id}
Body parameter
{
"recipe": {
"name": "string",
"description": "string",
"ingredients": [
"string"
],
"directions": [
"string"
],
"category": "string",
"date": "2019-08-24T14:15:22Z"
},
"details": {
"username": "string",
"password": "string",
"enabled": true,
"authorities": [
{
"authority": "string"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true
}
}| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | integer(int64) | true | none |
| body | body | object | true | none |
| » recipe | body | Recipe | false | none |
| »» name | body | string | true | none |
| »» description | body | string | true | none |
| »» ingredients | body | [string] | true | none |
| »» directions | body | [string] | true | none |
| »» category | body | string | true | none |
| »» date | body | string(date-time) | false | none |
| » details | body | UserDetailsImpl | false | none |
| »» username | body | string | false | none |
| »» password | body | string | false | none |
| »» enabled | body | boolean | false | none |
| »» authorities | body | [GrantedAuthority] | false | none |
| »»» authority | body | string | false | none |
| »» accountNonLocked | body | boolean | false | none |
| »» credentialsNonExpired | body | boolean | false | none |
| »» accountNonExpired | body | boolean | false | none |
Example responses
200 Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | string |
Code samples
# You can also use wget
curl -X DELETE http://localhost:8881/api/recipe/{id} \
-H 'Content-Type: application/json' \
-H 'Accept: */*'
DELETE http://localhost:8881/api/recipe/{id} HTTP/1.1
Host: localhost:8881
Content-Type: application/json
Accept: */*
const inputBody = '{
"username": "string",
"password": "string",
"enabled": true,
"authorities": [
{
"authority": "string"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch('http://localhost:8881/api/recipe/{id}',
{
method: 'DELETE',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.delete 'http://localhost:8881/api/recipe/{id}',
params: {
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.delete('http://localhost:8881/api/recipe/{id}', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => '*/*',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('DELETE','http://localhost:8881/api/recipe/{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("http://localhost:8881/api/recipe/{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{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("DELETE", "http://localhost:8881/api/recipe/{id}", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}DELETE /api/recipe/{id}
Body parameter
{
"username": "string",
"password": "string",
"enabled": true,
"authorities": [
{
"authority": "string"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true
}| Name | In | Type | Required | Description |
|---|---|---|---|---|
| id | path | integer(int64) | true | none |
| body | body | UserDetailsImpl | false | none |
Example responses
200 Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | string |
Code samples
# You can also use wget
curl -X POST http://localhost:8881/api/recipe/new \
-H 'Content-Type: application/json' \
-H 'Accept: */*'
POST http://localhost:8881/api/recipe/new HTTP/1.1
Host: localhost:8881
Content-Type: application/json
Accept: */*
const inputBody = '{
"recipe": {
"name": "string",
"description": "string",
"ingredients": [
"string"
],
"directions": [
"string"
],
"category": "string",
"date": "2019-08-24T14:15:22Z"
},
"details": {
"username": "string",
"password": "string",
"enabled": true,
"authorities": [
{
"authority": "string"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true
}
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch('http://localhost:8881/api/recipe/new',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post 'http://localhost:8881/api/recipe/new',
params: {
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post('http://localhost:8881/api/recipe/new', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => '*/*',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','http://localhost:8881/api/recipe/new', 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("http://localhost:8881/api/recipe/new");
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{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "http://localhost:8881/api/recipe/new", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}POST /api/recipe/new
Body parameter
{
"recipe": {
"name": "string",
"description": "string",
"ingredients": [
"string"
],
"directions": [
"string"
],
"category": "string",
"date": "2019-08-24T14:15:22Z"
},
"details": {
"username": "string",
"password": "string",
"enabled": true,
"authorities": [
{
"authority": "string"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true
}
}| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | object | true | none |
| » recipe | body | Recipe | false | none |
| »» name | body | string | true | none |
| »» description | body | string | true | none |
| »» ingredients | body | [string] | true | none |
| »» directions | body | [string] | true | none |
| »» category | body | string | true | none |
| »» date | body | string(date-time) | false | none |
| » details | body | UserDetailsImpl | false | none |
| »» username | body | string | false | none |
| »» password | body | string | false | none |
| »» enabled | body | boolean | false | none |
| »» authorities | body | [GrantedAuthority] | false | none |
| »»» authority | body | string | false | none |
| »» accountNonLocked | body | boolean | false | none |
| »» credentialsNonExpired | body | boolean | false | none |
| »» accountNonExpired | body | boolean | false | none |
Example responses
200 Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| » additionalProperties | integer(int64) | false | none | none |
Code samples
# You can also use wget
curl -X GET http://localhost:8881/api/recipe/search \
-H 'Accept: */*'
GET http://localhost:8881/api/recipe/search HTTP/1.1
Host: localhost:8881
Accept: */*
const headers = {
'Accept':'*/*'
};
fetch('http://localhost:8881/api/recipe/search',
{
method: 'GET',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Accept' => '*/*'
}
result = RestClient.get 'http://localhost:8881/api/recipe/search',
params: {
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Accept': '*/*'
}
r = requests.get('http://localhost:8881/api/recipe/search', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Accept' => '*/*',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('GET','http://localhost:8881/api/recipe/search', 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("http://localhost:8881/api/recipe/search");
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{"*/*"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("GET", "http://localhost:8881/api/recipe/search", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}GET /api/recipe/search
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| category | query | string | false | none |
| name | query | string | false | none |
Example responses
200 Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | Inline |
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| anonymous | [Recipe] | false | none | none |
| » name | string | true | none | none |
| » description | string | true | none | none |
| » ingredients | [string] | true | none | none |
| » directions | [string] | true | none | none |
| » category | string | true | none | none |
| » date | string(date-time) | false | none | none |
Code samples
# You can also use wget
curl -X POST http://localhost:8881/api/register \
-H 'Content-Type: application/json' \
-H 'Accept: */*'
POST http://localhost:8881/api/register HTTP/1.1
Host: localhost:8881
Content-Type: application/json
Accept: */*
const inputBody = '{
"email": "string",
"password": "stringst"
}';
const headers = {
'Content-Type':'application/json',
'Accept':'*/*'
};
fetch('http://localhost:8881/api/register',
{
method: 'POST',
body: inputBody,
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});require 'rest-client'
require 'json'
headers = {
'Content-Type' => 'application/json',
'Accept' => '*/*'
}
result = RestClient.post 'http://localhost:8881/api/register',
params: {
}, headers: headers
p JSON.parse(result)import requests
headers = {
'Content-Type': 'application/json',
'Accept': '*/*'
}
r = requests.post('http://localhost:8881/api/register', headers = headers)
print(r.json())<?php
require 'vendor/autoload.php';
$headers = array(
'Content-Type' => 'application/json',
'Accept' => '*/*',
);
$client = new \GuzzleHttp\Client();
// Define array of request body.
$request_body = array();
try {
$response = $client->request('POST','http://localhost:8881/api/register', 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("http://localhost:8881/api/register");
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{
"Content-Type": []string{"application/json"},
"Accept": []string{"*/*"},
}
data := bytes.NewBuffer([]byte{jsonReq})
req, err := http.NewRequest("POST", "http://localhost:8881/api/register", data)
req.Header = headers
client := &http.Client{}
resp, err := client.Do(req)
// ...
}POST /api/register
Body parameter
{
"email": "string",
"password": "stringst"
}| Name | In | Type | Required | Description |
|---|---|---|---|---|
| body | body | User | true | none |
Example responses
200 Response
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | string |
{
"name": "string",
"description": "string",
"ingredients": [
"string"
],
"directions": [
"string"
],
"category": "string",
"date": "2019-08-24T14:15:22Z"
}
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| name | string | true | none | none |
| description | string | true | none | none |
| ingredients | [string] | true | none | none |
| directions | [string] | true | none | none |
| category | string | true | none | none |
| date | string(date-time) | false | none | none |
{
"authority": "string"
}
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| authority | string | false | none | none |
{
"username": "string",
"password": "string",
"enabled": true,
"authorities": [
{
"authority": "string"
}
],
"accountNonLocked": true,
"credentialsNonExpired": true,
"accountNonExpired": true
}
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| username | string | false | none | none |
| password | string | false | none | none |
| enabled | boolean | false | none | none |
| authorities | [GrantedAuthority] | false | none | none |
| accountNonLocked | boolean | false | none | none |
| credentialsNonExpired | boolean | false | none | none |
| accountNonExpired | boolean | false | none | none |
{
"email": "string",
"password": "stringst"
}
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
| string | true | none | none | |
| password | string | true | none | none |