Invoicing API
Project description
pnap-invoicing-api
List, fetch and pay invoices with the Invoicing API.
This Python package is automatically generated by the OpenAPI Generator project:
- API version: 1.0
- Package version: 1.0.5
- Build package: org.openapitools.codegen.languages.PythonClientCodegen For more information, please visit https://phoenixnap.com/
Requirements.
Python 3.9+
Installation & Usage
pip install
You can install this package directly from the Python Package Index using:
$ pip install pnap_invoicing_api
Then import the package:
import pnap_invoicing_api
Setuptools
Install via Setuptools.
python setup.py install --user
(or sudo python setup.py install to install the package for all users)
Then import the package:
import pnap_invoicing_api
Tests
Execute pytest to run the tests.
Getting Started
Please follow the installation procedure and then run the following:
import pnap_invoicing_api
from pnap_invoicing_api.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to https://api.phoenixnap.com/invoicing/v1
# See configuration.py for a list of all supported configuration parameters.
configuration = pnap_invoicing_api.Configuration(
host = "https://api.phoenixnap.com/invoicing/v1"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
configuration.access_token = os.environ["ACCESS_TOKEN"]
# Enter a context with an instance of the API client
with pnap_invoicing_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = pnap_invoicing_api.InvoicesApi(api_client)
number = '13218-1180326' # str | A user-friendly reference number assigned to the invoice. (optional)
status = 'status_example' # str | Payment status of the invoice. (optional)
sent_on_from = '2020-04-13T00:00:00.000Z' # datetime | Minimum value to filter invoices by sent on date. (optional)
sent_on_to = '2022-04-13T00:00:00.000Z' # datetime | Maximum value to filter invoices by sent on date. (optional)
limit = 100 # int | The limit of the number of results returned. The number of records returned may be smaller than the limit. (optional) (default to 100)
offset = 0 # int | The number of items to skip in the results. (optional) (default to 0)
sort_field = sentOn # str | If a sortField is requested, pagination will be done after sorting. Default sorting is by number. (optional) (default to sentOn)
sort_direction = DESC # str | Sort Given Field depending on the desired direction. Default sorting is descending. (optional) (default to DESC)
try:
# List invoices.
api_response = api_instance.invoices_get(number=number, status=status, sent_on_from=sent_on_from, sent_on_to=sent_on_to, limit=limit, offset=offset, sort_field=sort_field, sort_direction=sort_direction)
print("The response of InvoicesApi->invoices_get:\n")
pprint(api_response)
except ApiException as e:
print("Exception when calling InvoicesApi->invoices_get: %s\n" % e)
To generate a token using the python-keycloak library:
from keycloak import KeycloakOpenID
clientId = "YOUR_CLIENT_ID"
clientSecret = "YOUR_CLIENT_SECRET"
serverUrl = "https://auth.phoenixnap.com/auth/"
realmName = "BMC"
grantType = "client_credentials"
keycloakOpenId = KeycloakOpenID(server_url=serverUrl,
realm_name=realmName,
client_id=clientId,
client_secret_key=clientSecret)
ACCESS_TOKEN = keycloakOpenId.token(grant_type=grantType)['access_token']
Documentation for API Endpoints
All URIs are relative to https://api.phoenixnap.com/invoicing/v1
| Class | Method | HTTP request | Description |
|---|---|---|---|
| InvoicesApi | invoices_get | GET /invoices | List invoices. |
| InvoicesApi | invoices_invoice_id_generate_pdf_post | POST /invoices/{invoiceId}/actions/generate-pdf | Generate invoice details as PDF. |
| InvoicesApi | invoices_invoice_id_get | GET /invoices/{invoiceId} | Get invoice details. |
| InvoicesApi | invoices_invoice_id_pay_post | POST /invoices/{invoiceId}/actions/pay | Pay an invoice. |
Documentation For Models
Documentation For Authorization
Authentication schemes defined for the API:
OAuth2
- Type: OAuth
- Flow: application
- Authorization URL:
- Scopes:
- invoices: Grants full access to Invoicing API.
- invoices.read: Grants read only access to Invoicing API.
Author
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pnap_invoicing_api-1.0.5.tar.gz.
File metadata
- Download URL: pnap_invoicing_api-1.0.5.tar.gz
- Upload date:
- Size: 26.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e10acce244308881648cdd0c773def46afc96546ee94b9e44f95b740e44dbc7
|
|
| MD5 |
f37d208747f7c332f59d2ade492f7eed
|
|
| BLAKE2b-256 |
2627fc1649146726cb4475be80cf5a7577b73d6922f4e7038cc97dbee4bffef3
|
File details
Details for the file pnap_invoicing_api-1.0.5-py3-none-any.whl.
File metadata
- Download URL: pnap_invoicing_api-1.0.5-py3-none-any.whl
- Upload date:
- Size: 31.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.20
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
730db614a79883fca5ea8cf796e20b0a41b76f78ce95c557c972ac56c535cea1
|
|
| MD5 |
eb47486cc713197f5d9b9e79a4fbc695
|
|
| BLAKE2b-256 |
016678c7d2bb6ea68163247c5e983537733c9a483c86d0e6635d6266cf7f807c
|