Skip to content

Latest commit

 

History

History
777 lines (585 loc) · 19.1 KB

File metadata and controls

777 lines (585 loc) · 19.1 KB
title Cake API v1.2.32
language_tabs
java
Java
language_clients
java
toc_footers
includes
search false
highlight_theme darkula
headingLevel 2

Cake API v1.2.32

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

This is a sample of Cake server created using springdocs - a library for OpenAPI 3 with spring boot.

Base URLs:

License: Apache 2.0

Authentication

Scope Scope Description
users:read Read user information
im:read Read messages

other

API with documentation annotations

Get all cakes

Code samples

URL obj = new URL("/v1/othercake");
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());

GET /v1/othercake

Retrieve all cakes from the server, this is very slow operation since all cakes are baked synchronously, so all of them are made according to their preparation time.

Example responses

200 Response

[
  {
    "name": "cheese cake",
    "prepTimeMin": 60,
    "components": [
      {
        "name": "string",
        "quantity": 0,
        "unit": "string"
      }
    ]
  }
]

400 Response

Responses

Status Meaning Description Schema
200 OK default response Inline
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Cake] false none none
» name string true none Name of the cake.
» prepTimeMin integer(int32) false none Preparation time in minues.
» components [Ingredient] true none List if ingredients.
»» name string true none none
»» quantity number(double) true none none
»» unit string true none none
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Create cake

Code samples

URL obj = new URL("/v1/othercake");
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());

POST /v1/othercake

Yummy yummy yummy!

Body parameter

{
  "name": "cheese cake",
  "prepTimeMin": 60,
  "components": [
    {
      "name": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body Cake false Body of the request should contain cake definition

Example responses

400 Response

Responses

Status Meaning Description Schema
200 OK default response None
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Find cake by name

Code samples

URL obj = new URL("/v1/othercake/{cake}");
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());

GET /v1/othercake/{cake}

Get recipe of particular cake

Parameters

Name In Type Required Description
cake path string true cake name to be retrieved from database

Example responses

200 Response

{
  "name": "cheese cake",
  "prepTimeMin": 60,
  "components": [
    {
      "name": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}

400 Response

Responses

Status Meaning Description Schema
200 OK default response Cake
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Update cake by name

Code samples

URL obj = new URL("/v1/othercake/{cake}");
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());

PUT /v1/othercake/{cake}

Update the recipe of particular cake

Body parameter

{
  "name": "cheese cake",
  "prepTimeMin": 60,
  "components": [
    {
      "name": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body Cake false Body of the request should contain cake definition

Example responses

400 Response

Responses

Status Meaning Description Schema
200 OK default response None
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Delete cake by name

Code samples

URL obj = new URL("/v1/othercake/{cake}");
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());

DELETE /v1/othercake/{cake}

I don't know why one might want that!

Parameters

Name In Type Required Description
cake path string true cake name to be retrieved from database

Example responses

400 Response

Responses

Status Meaning Description Schema
200 OK default response None
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

cake

API with documentation annotations

Get all cakes

Code samples

URL obj = new URL("/v1/cake");
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());

GET /v1/cake

Retrieve all cakes from the server, this is very slow operation since all cakes are baked synchronously, so all of them are made according to their preparation time.

Example responses

200 Response

[
  {
    "name": "cheese cake",
    "prepTimeMin": 60,
    "components": [
      {
        "name": "string",
        "quantity": 0,
        "unit": "string"
      }
    ]
  }
]

400 Response

Responses

Status Meaning Description Schema
200 OK default response Inline
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Cake] false none none
» name string true none Name of the cake.
» prepTimeMin integer(int32) false none Preparation time in minues.
» components [Ingredient] true none List if ingredients.
»» name string true none none
»» quantity number(double) true none none
»» unit string true none none
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Create cake

Code samples

URL obj = new URL("/v1/cake");
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());

POST /v1/cake

Yummy yummy yummy!

Body parameter

{
  "name": "cheese cake",
  "prepTimeMin": 60,
  "components": [
    {
      "name": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body Cake false Body of the request should contain cake definition

Example responses

400 Response

Responses

Status Meaning Description Schema
200 OK default response None
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Find cake by name

Code samples

URL obj = new URL("/v1/cake/{cake}");
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());

GET /v1/cake/{cake}

Get recipe of particular cake

Parameters

Name In Type Required Description
cake path string true cake name to be retrieved from database

Example responses

200 Response

{
  "name": "cheese cake",
  "prepTimeMin": 60,
  "components": [
    {
      "name": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}

400 Response

Responses

Status Meaning Description Schema
200 OK default response Cake
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Update cake by name

Code samples

URL obj = new URL("/v1/cake/{cake}");
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());

PUT /v1/cake/{cake}

Update the recipe of particular cake

Body parameter

{
  "name": "cheese cake",
  "prepTimeMin": 60,
  "components": [
    {
      "name": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}

Parameters

Name In Type Required Description
body body Cake false Body of the request should contain cake definition

Example responses

400 Response

Responses

Status Meaning Description Schema
200 OK default response None
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Delete cake by name

Code samples

URL obj = new URL("/v1/cake/{cake}");
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());

DELETE /v1/cake/{cake}

I don't know why one might want that!

Parameters

Name In Type Required Description
cake path string true cake name to be retrieved from database

Example responses

400 Response

Responses

Status Meaning Description Schema
200 OK default response None
400 Bad Request default response ErrorCodeResponse
404 Not Found default response ErrorCodeResponse
To perform this operation, you must be authenticated by means of one of the following methods: bearerAuth, authorizationCode

Schemas

ErrorCodeResponse

{
  "code": "string",
  "message": "string"
}

Properties

Name Type Required Restrictions Description
code string false none none
message string false none none

Cake

{
  "name": "cheese cake",
  "prepTimeMin": 60,
  "components": [
    {
      "name": "string",
      "quantity": 0,
      "unit": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
name string true none Name of the cake.
prepTimeMin integer(int32) false none Preparation time in minues.
components [Ingredient] true none List if ingredients.

Ingredient

{
  "name": "string",
  "quantity": 0,
  "unit": "string"
}

List if ingredients.

Properties

Name Type Required Restrictions Description
name string true none none
quantity number(double) true none none
unit string true none none