{
    "openapi": "3.0.1",
    "info": {
        "title": "JSON storage",
        "description": "JSON storage API",
        "version": "0.1"
    },
    "servers": [
        {
            "url": "https://extendsclass.com/api/json-storage"
        }
    ],
    "paths": {
        "/bin/{id}": {
			"parameters": [
              {
                "name": "id",
                "in": "path",
                "required": true,
                "schema": {
                  "type": "string"
                }
              }
            ],
            "get": {
                "summary": "Return a json bin",
                "responses": {
                    "200": {
                        "description": "Bin data",
                        "content": {
                            "application/json": {
							"schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Bin not found",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Id must be specified",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "summary": "Update a json bin",
                "responses": {
                    "200": {
                        "description": "Bin data updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UpdateStatus"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Wrong security key",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Bin not found",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "JSON data too large",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Id must be specified",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "patch": {
                "summary": "Partially update a json bin with JSON Merge Patch",
                "responses": {
                    "200": {
                        "description": "Bin data updated",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/UpdateStatus"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Wrong security key",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Bin not found",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "JSON data too large",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Id must be specified",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "summary": "Delete a json bin",
                "responses": {
                    "200": {
                        "description": "Status of the deletion",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DeleteStatus"
                                }
                            }
                        }
                    },
                    "401": {
                        "description": "Wrong security key",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Bin not found",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Id must be specified",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }

        },
        "/bin": {
            "post": {
                "summary": "Create a json bin",
                "responses": {
                    "200": {
                        "description": "Bin information (id and URL)",
                        "content": {
                            "application/json": {
								"schema": {
                                    "$ref": "#/components/schemas/CreateStatus"
                                }
                            }
                        }
                    },
                    "413": {
                        "description": "'JSON data too large' or 'Security key is too large'",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    },
                    "422": {
                        "description": "Security key is required for private bin",
                        "content": {
                            "application/json": {
							"schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
		}
    },
    "components": {
        "schemas": {
            "CreateStatus": {
                "properties": {
                    "status": {
                        "title": "Update status (0: Success)",
                        "type": "integer"
                    },
                    "uri": {
                        "title": "URI of the bin",
                        "type": "string"
                    },
                    "id": {
                        "title": "Id of the bin",
                        "type": "string"
                    }
                }
            },
            "UpdateStatus": {
                "properties": {
                    "status": {
                        "title": "Update status (0: Success)",
                        "type": "integer"
                    },
                    "data": {
                        "title": "Data updated",
                        "type": "object"
                    }
                }
            },
			"DeleteStatus": {
                "properties": {
                    "status": {
                        "title": "Update status (0: Success)",
                        "type": "integer"
                    }
                }
            },
			"Error": {
                "properties": {
                    "status": {
                        "title": "Status (1: Error)",
                        "type": "integer"
                    },
                    "message": {
                        "title": "Error message",
                        "type": "string"
                    }
                }
            }
		}
	}
}
