Skip to content

Latest commit

 

History

History
142 lines (136 loc) · 2.37 KB

File metadata and controls

142 lines (136 loc) · 2.37 KB

API Examples

/company/gb

GET

Listing all previous reports

curl -L -X 'GET' 'http://0.0.0.0:5000/company/gb'

Returns:

{
  "reports": [
    {
      "equity": 234.56,
      "id": "report1",
      "retained_earnings": 345.67,
      "sales": 1234.56,
      "score": 6.07242023479448,
      "total_assets": 345.67,
      "total_liabilities": 456.78,
      "year": 2020
    }
  ]
}

/company/gb/<report>

GET

Listing a financial report.

curl -L -X 'GET' 'http://0.0.0.0:5000/company/gb/report1'

Returns:

{
  "reports": [
    {
      "equity": 234.56,
      "id": "report1",
      "retained_earnings": 345.67,
      "sales": 1234.56,
      "score": 6.07242023479448,
      "total_assets": 345.67,
      "total_liabilities": 456.78,
      "year": 2020
    }
  ]
}

PUT

Generating a new financial report.

curl -L \
	-X 'PUT' \
	-H 'content-type: application/json' \
	-d '{
		"financials": [
			{
				"year": 2020,
				"ebit": 123.45,
				"equity": 234.56,
				"retained_earnings": 345.67,
				"sales": 1234.56,
				"total_assets": 345.67,
				"total_liabilities": 456.78
			},
			{
				"year": 2010,
				"ebit": 123.45,
				"equity": 234.56,
				"retained_earnings": 345.67,
				"sales": 1234.56,
				"total_assets": 345.67,
				"total_liabilities": 456.78
			}
		]
	}' \
	'http://0.0.0.0:5000/company/gb/report1'

Returns:

{
  "reports": [
    {
      "equity": 234.56,
      "id": "report1",
      "retained_earnings": 345.67,
      "sales": 1234.56,
      "score": 6.07242023479448,
      "total_assets": 345.67,
      "total_liabilities": 456.78,
      "year": 2020
    }
  ]
}

If the Report already exists:

{
  "code": 2001,
  "error": "<class 'app.controllers.reports.DuplicateException'>",
  "message": [
    "The Report already exists!"
  ]
}

If there is any missing value:

{
  "code": 3000,
  "error": "<class 'app.forms.financials.FinancialsException'>",
  "message": [
    "Invalid financials sales."
  ]
}

DELETE

Deleting a financial report.

curl -L -X 'DELETE' 'http://0.0.0.0:5000/company/gb/report1'

Returns:

{
  "reports": [
    {
      "equity": 234.56,
      "id": "report1",
      "retained_earnings": 345.67,
      "sales": 1234.56,
      "score": 6.07242023479448,
      "total_assets": 345.67,
      "total_liabilities": 456.78,
      "year": 2020
    }
  ]
}