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.6
- 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
Release files for pnap-invoicing-api 1.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pnap_invoicing_api-1.0.6.tar.gz | 26.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pnap_invoicing_api-1.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 57.9 kB
Release files / pnap_invoicing_api-1.0.6.tar.gz
| Download URL | pnap_invoicing_api-1.0.6.tar.gz |
|---|---|
| Size | 26.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0858e85876ba3868b75a59d6cb9a3cb1fdc17735b2d7aa8488e9161e2db1b049
|
|
BLAKE2b-256 checksum How to use checksums |
81aa6f1c29f9bf76b314c2e8ae4d60e9f3283e01aa864403631ed2eef74b250f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|
Release files / pnap_invoicing_api-1.0.6-py3-none-any.whl
| Download URL | pnap_invoicing_api-1.0.6-py3-none-any.whl |
|---|---|
| Size | 31.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5dca2598c0f2476b39c1cb0740bd59ffa5846496dc0a74fcc3ce5ab91ea61a64
|
|
BLAKE2b-256 checksum How to use checksums |
d92eaafa27afb861467aa0d8a999b6b6eb0b005e8e4a5aa30fc6bf4f3d05c965
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.20
|