1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +01:00
This commit is contained in:
David Bomba 2023-02-18 19:58:52 +11:00
parent 3889c3cb53
commit 4f966c775c
3 changed files with 845 additions and 0 deletions

View File

@ -0,0 +1,192 @@
parameters:
X-API-SECRET:
name: X-API-SECRET
in: header
description: 'The API secret as defined by the .env variable API_SECRET. Only needed for self hosted users, and only applicable on the login route.'
required: false
schema:
type: string
example: password
X-Requested-With:
name: X-Requested-With
in: header
description: 'Used to send the XMLHttpRequest header'
required: true
schema:
type: string
readOnly: true
example: XMLHttpRequest
X-API-TOKEN:
name: X-API-TOKEN
in: header
description: 'The API token to be used for authentication'
required: true
schema:
type: string
example: TOKEN
X-API-PASSWORD:
name: X-API-PASSWORD
in: header
description: 'The login password when challenged on certain protected routes'
required: false
schema:
type: string
example: supersecretpassword
bank_integration_include:
name: include
in: query
description: Include child relations of the BankIntegration object. Format is comma separated.
require: false
schema:
type: string
examples:
company:
value: company
summary: The associated Company
account:
value: account
summary: The associated Account
bank_transactions:
value: bank_transactions
summary: The associated Bank Transactions
client_include:
name: include
in: query
description: Include child relationships of the Client Object.
required: false
schema:
type: string
examples:
activities:
value: activities
summary: include=activities will include the activities object in the response
ledger:
value: ledger
summary: include=ledger will include the ledger object in the response
system_logs:
value: system_logs
summary: include=system_logs will include the system_logs object in the response
activity_include:
name: include
in: query
description: Include child relations of the Activity object, format is comma separated. **Note** it is possible to chain multiple includes together, ie. include=account,token
required: false
schema:
type: string
examples:
history:
value: history
summary: include=history will include the history object in the response (This could include references to the backup HTML of the entity)
user:
value: user
summary: include=user will include the user object in the response
client:
value: client
summary: include=client will include the client object in the response
recurring_invoice:
value: recurring_invoice
summary: include=recurring_invoice will include the recurring_invoice object in the response
invoice:
value: invoice
summary: include=invoice will include the invoice object in the response
credit:
value: credit
summary: include=credit will include the credit object in the response
quote:
value: quote
summary: include=quote will include the quote object in the response
payment:
value: payment
summary: include=payment will include the payment object in the response
expense:
value: expense
summary: include=expense will include the expense object in the response
vendor_contact:
value: vendor_contact
summary: include=vendor_contact will include the vendor_contact object in the response
vendor:
value: vendor
summary: include=vendor will include the vendor object in the response
purchase_order:
value: purchase_order
summary: include=purchase_order will include the purchase_order object in the response
task:
value: task
summary: include=task will include the task object in the response
login_include:
name: include
in: query
description: Include child relations of the CompanyUser object, format is comma separated. **Note** it is possible to chain multiple includes together, ie. include=account,token
required: false
schema:
type: string
examples:
user:
value: user
summary: include=user will include the user object in the response
company:
value: company
summary: include=company will include the company object in the response
token:
value: token
summary: include=token will include the token object in the response
account:
value: account
summary: include=account will include the account object in the response
per_page_meta:
name: per_page
in: query
description: The number of records to return for each request, default is 20
required: false
schema:
type: int
example: 20
page_meta:
name: page
in: query
description: The page number to return for this request (when performing pagination), default is 1
required: false
schema:
type: int
example: 1
include:
name: include
in: query
description: 'Includes child relationships in the response, format is comma separated. Check each model for the list of associated includes'
required: false
schema:
type: string
example: 'first_load'
include_static:
name: include_static
in: query
description: 'Returns static variables'
required: false
schema:
type: string
example: include_static=true
clear_cache:
name: clear_cache
in: query
description: 'Clears the static cache'
required: false
schema:
type: string
example: clear_cache=true
index:
name: index
in: query
description: 'Replaces the default response index from data to a user specific string'
required: false
schema:
type: string
example: user
api_version:
name: api_version
in: query
description: 'The API version'
required: false
schema:
type: number
example: user

View File

@ -0,0 +1,68 @@
########################### Generic filters available across all filter ##################################
status:
name: status
in: query
description: |
Filter the entity based on their status. ie active / archived / deleted. Format is a comma separated string with any of the following options:
- active
- archived
- deleted
required: false
schema:
type: string
example: ?status=archived,deleted
client_id:
name: client_id
in: query
description: |
Filters the entity list by client_id. Suitable when you only want the entities of a specific client.
required: false
schema:
type: string
example: ?client_id={client_id}
created_at:
name: created_at
in: query
description: |
Filters the entity list by the created at timestamp. Parameter value can be a datetime string or unix timestamp
required: false
schema:
type: integer
example: ?created_at=2022-01-10
updated_at:
name: updated_at
in: query
description: |
Filters the entity list by the updated at timestamp. Parameter value can be a datetime string or unix timestamp
required: false
schema:
type: integer
example: ?updated_at=2022-01-10
is_deleted:
name: is_deleted
in: query
description: |
Filters the entity list by entities that have been deleted.
required: false
schema:
type: booleans
example: ?is_deleted=true
vendor_id:
name: vendor_id
in: query
description: |
Filters the entity list by an associated vendor
required: false
schema:
type: string
example: ?vendor_id={vendor_id}
filter_deleted_clients:
name: filter_deleted_clients
in: query
description: |
Filters the entity list and only returns entities for clients that have not been deleted
required: false
schema:
type: string
example: ?filter_deleted_clients=true
########################### Generic filters available across all filter ##################################

585
openapi/paths/invoices.yaml Normal file
View File

@ -0,0 +1,585 @@
/api/v1/invoices:
get:
tags:
- invoices
summary: "List invoices"
description: |
Lists invoices with the option to chain multiple query parameters allowing fine grained filtering of the list.
operationId: getInvoices
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- $ref: "#/components/parameters/status"
- $ref: "#/components/parameters/client_id"
- $ref: "#/components/parameters/created_at"
- $ref: "#/components/parameters/updated_at"
- $ref: "#/components/parameters/is_deleted"
- $ref: "#/components/parameters/filter_deleted_clients"
- $ref: "#/components/parameters/vendor_id"
- name: client_status
in: query
description: |
A comma separated list of invoice status strings. Valid options include:
- all
- paid
- unpaid
- overdue
required: false
schema:
type: string
example: ?client_status=paid,unpaid
- name: number
in: query
description: |
Search invoices by invoice number
required: false
schema:
type: string
example: ?number=INV-001
- name: filter
in: query
description: |
Searches across a range of columns including:
- number
- po_number
- date
- amount
- balance
- custom_value1
- custom_value2
- custom_value3
- custom_value4
required: false
schema:
type: string
example: ?filter=bob
- name: without_deleted_clients
in: query
description: |
Returns the invoice list without the invoices of deleted clients.
required: false
schema:
type: string
example: ?without_deleted_clients=
- name: overdue
in: query
description: |
Returns the list of invoices that are overdue
required: false
schema:
type: string
example: ?over_due=
- name: payable
in: query
description: |
Returns the invoice list that are payable for a defined client. Please note, you must pass the client_id as the value for this query parameter
required: false
schema:
type: string
example: ?payable={client_id}
- name: sort
in: query
description: Returns the list sorted by column in ascending or descending order.
required: false
schema:
type: string
example: id|desc number|desc balance|asc
- name: private_notes
in: query
description: |
Searches on the private_notes field of the invoices
required: false
schema:
type: string
example: ?private_notes=super secret
responses:
200:
description: "A list of invoices"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
post:
tags:
- invoices
summary: "Create invoice"
description: "Adds a invoice to a company"
operationId: storeInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
requestBody:
required: true
content:
application/json:
schema:
$ref: "#/components/schemas/FillableInvoice"
responses:
200:
description: "Returns the saved invoice entity"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
"/api/v1/invoices/{id}":
get:
tags:
- invoices
summary: "Show invoice"
description: "Displays an invoice by id"
operationId: showInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Invoice Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the invoice object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
put:
tags:
- invoices
summary: "Update invoice"
description: "Handles the updating of an invoice by id"
operationId: updateInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Invoice Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the invoice object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
delete:
tags:
- invoices
summary: "Delete invoice"
description: "Handles the deletion of an invoice by id"
operationId: deleteInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Invoice Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns a HTTP status"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
"/api/v1/invoices/{id}/edit":
get:
tags:
- invoices
summary: "Edit invoice"
description: "Displays an invoice by id for editting"
operationId: editInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Invoice Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the invoice object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
/api/v1/invoices/create:
get:
tags:
- invoices
summary: "Blank invoice"
description: "Returns a blank object with default values"
operationId: getInvoicesCreate
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
responses:
200:
description: "A blank invoice object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
/api/v1/invoices/bulk:
post:
tags:
- invoices
summary: "Bulk invoice actions"
description: ""
operationId: bulkInvoices
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/index"
requestBody:
description: "Bulk action details"
required: true
content:
application/json:
schema:
type: object
properties:
action:
type: string
description: "The action to be performed"
examples:
bulk_download:
value: bulk_download
summary: Bulk download an array of invoice PDFs (These are sent to the admin via email.)
account:
value: account
summary: The associated Account
bank_transactions:
value: bank_transactions
summary: The associated Bank Transactions
ids:
type: array
items:
description: "Array of hashed IDs to be bulk 'actioned"
type: integer
example: "[0,1,2,3]"
responses:
200:
description: "The Bulk Action response"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
"/api/v1/invoices/{id}/{action}":
get:
deprecated: true
tags:
- invoices
summary: "Custom invoice action"
description: |
Performs a custom action on an invoice.
The current range of actions are as follows
- clone_to_invoice
- clone_to_quote
- history
- delivery_note
- mark_paid
- download
- archive
- delete
- email
operationId: actionInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Invoice Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
- name: action
in: path
description: "The action string to be performed"
required: true
schema:
type: string
format: string
example: clone_to_quote
responses:
200:
description: "Returns the invoice object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
"/api/v1/invoice/{invitation_key}/download":
get:
tags:
- invoices
summary: "Download invoice PDF"
description: "Downloads a specific invoice"
operationId: downloadInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: invitation_key
in: path
description: "The Invoice Invitation Key"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the invoice pdf"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
"/api/v1/invoices/{id}/delivery_note":
get:
tags:
- invoices
summary: "Download delivery note"
description: "Downloads a specific invoice delivery notes"
operationId: deliveryNote
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Invoice Hahsed Id"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the invoice delivery note pdf"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"
"/api/v1/invoices/{id}/upload":
put:
tags:
- invoices
summary: "Add invoice document"
description: "Handles the uploading of a document to a invoice"
operationId: uploadInvoice
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Invoice Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the Invoice object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Invoice"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: "#/components/responses/422"
default:
$ref: "#/components/responses/default"