# Cloudspot API wrapper
Basic wrapper for the Cloudspot ERP API.
# Use cases
This wrapper has two use cases:
~~1. Authenticate and authorize users on an external app, linked to Cloudspot ERP~~
2. Get data (products, clients,...) from a company that is present on the Cloudspot ERP
:warning:
**Warning**
**The authentication and authorization for external apps is migrated to Cloudspot License server as of 2023-03-14.**
[You can find the new wrapper here.](https://github.com/Ecosy-EU/cloudspot-license-api)
# Getting started
### Install
Install with pip.
```python
pip install cloudspot-erp-api
```
### Import
Depending on your use case, you'll need to import either ```CloudspotERP_UserAPI``` or ```CloudspotERP_CompanyAPI```.
```python
# Use case 1
from cloudspot.api import CloudspotERP_UserAPI
# Use case 2
from cloudspot.api import CloudspotERP_CompanyAPI
```
# Functionalities
## CloudspotERP_UserAPI
:warning:
**Warning**
**The authentication and authorization for external apps is migrated to Cloudspot License server as of 2023-03-14.**
[You can find the new wrapper here.](https://github.com/Ecosy-EU/cloudspot-license-api)
## CloudspotERP_CompanyAPI
**This class is used to retrieve data from a company.**
### Setup
When setting up the class, one parameter is expected: the generated API token of the company.
This token can be generated by an ERP administrator for a specific company.
A token can have the right to:
- See all products
- See all clients
```python
from cloudspot.api import CloudspotERP_CompanyAPI
api = CloudspotERP_CompanyAPI('[TOKEN]')
```
After setting up the connection, you can use the ```api``` to send requests to the Cloudspot ERP.
### All products
Below method will allow you to retrieve all the products that are available inside the ERP and are linked to the company by the token.
The ```.list()``` method will return one ```Artikels``` object, which is a list containing one or multiple ```Artikel``` objects.
```python
artikels = api.artikels.list()
for artikel in artikels.items():
print('naam: ', artikel.naam)
```
#### Available attributes
Following attributes are available for the ```Artikel``` object:
| Attribute | Type | Remarks |
| ------------- | ------------- | ------------- |
| naam | string | Name of the product |
| beschrijving | text | Long description of the product |
| SKU | string | Stock Keeping Unit |
| voorraad_bijhouden | string | Can only contain one of these three values: "NIET" / "FYSIEK" / "DIGITAAL" |
| op_voorraad | float | How many units are currently in stock, only applicable of voorraad_bijhouden is "FYSIEK" |
| product_url | url | External URL with the product information |
| verkoopprijs_excl | float | Sales price, excl. VAT |
| verkoopprijs_incl | float | Sales price, incl. VAT |
| inkoopprijs_excl | float | Purchase price, excl. VAT |
| inkoopprijs_incl | float | Purchase price, incl. VAT |
| BTW | float | Percentage of VAT applicable to the product |
| bestellingtype | string | Can only contain one of these two values: "IDEAAL" / "BESTELLING" |
| units_per_bestelling | float | Minimum amount of units needed for an order to the vendor |
| status | string | Can only contain one of these three values: "ZICHTBAAR" / "NIET_VERKOOPBAAR" / "GEDEACTIVEERD" |
### Specific product
Below method will allow you to retrieve a specific product by ID. Will only return the article if the article is in the company that is linked to the token.
The ```.get(id)``` method will return one ```Artikel``` object.
```python
artikel = api.artikels.get(125) # Retrieve artikel with ID 125
print('naam: ', artikel.naam)
```
### All clients
Below method will allow you to retrieve all the clients that are available inside the ERP and are linked to the company by the token.
The ```.list()``` method will return one ```Klanten``` object, which is a list containing one or multiple ```Klant``` objects.
```python
klanten = api.klanten.list()
for klant in klanten.items():
print('voornaam: ', klant.voornaam)
```
#### Available attributes
Following attributes are available for the ```Klant``` object:
| Attribute | Type | Remarks |
| ------------- | ------------- | ------------- |
| klantennummer | integer | Client number/reference |
| aanspreektitel | string | Can only contain one of these two values: "Mijnh." / "Mevr." |
| voornaam | string | First name of client |
| achternaam | string | Last name of client |
| straat | string | Street |
| huisnummer | string | House number |
| busnummer | string | Box number |
| postcode | string | Zipcode |
| plaats | string | Place/region |
| land | string | Two letter country code (ex. BE/NL/FR/...) |
| geboortedatum | date | Birthday of client |
| geboorteplaats | string | Place of birth |
| is_bedrijf | boolean | Indicates wether the client is a company or not. True = client is a company, False = client is not a company |
| bedrijfsnaam | string | Name of the company. Only applicable if is_bedrijf is True |
| BTW_nummer | string | VAT number of the company. Only applicable if is_bedrijf is True |
| ondernemingsnummer | string | KBO number of the company. Only applicable if is_bedrijf is True |
### Error handling
Basic error handling has been added.
You can check if an error has occured during a call by checking the hasError attribute on the object.
If the hasError attribute has been set to True, an Error object will be attached to the error attribute of the same object.
The Error object contains one attribute: message. This will contain the error message.
```python
artikels = api.artikels.list()
if artikels.hasError:
print('error: ', artikels.error.message)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Ecosy-EU/inktool-wrapper",
"name": "cloudspot-erp-api",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "cloudspot",
"author": "Alexander Schillemans",
"author_email": "alexander.schillemans@lhs.global",
"download_url": "https://files.pythonhosted.org/packages/79/2e/5e5f80aad01637d943a73b92f95365b570502a644c2beef42654820673ec/cloudspot-erp-api-1.1.0.tar.gz",
"platform": null,
"description": "# Cloudspot API wrapper\r\nBasic wrapper for the Cloudspot ERP API.\r\n\r\n# Use cases\r\nThis wrapper has two use cases:\r\n~~1. Authenticate and authorize users on an external app, linked to Cloudspot ERP~~\r\n2. Get data (products, clients,...) from a company that is present on the Cloudspot ERP\r\n\r\n:warning:\r\n**Warning**\r\n\r\n**The authentication and authorization for external apps is migrated to Cloudspot License server as of 2023-03-14.**\r\n[You can find the new wrapper here.](https://github.com/Ecosy-EU/cloudspot-license-api)\r\n\r\n# Getting started\r\n\r\n### Install\r\n\r\nInstall with pip.\r\n\r\n```python\r\npip install cloudspot-erp-api\r\n```\r\n\r\n### Import\r\n\r\nDepending on your use case, you'll need to import either ```CloudspotERP_UserAPI``` or ```CloudspotERP_CompanyAPI```.\r\n\r\n```python\r\n# Use case 1\r\nfrom cloudspot.api import CloudspotERP_UserAPI\r\n\r\n# Use case 2\r\nfrom cloudspot.api import CloudspotERP_CompanyAPI\r\n```\r\n\r\n# Functionalities\r\n\r\n## CloudspotERP_UserAPI\r\n\r\n:warning:\r\n**Warning**\r\n\r\n**The authentication and authorization for external apps is migrated to Cloudspot License server as of 2023-03-14.**\r\n[You can find the new wrapper here.](https://github.com/Ecosy-EU/cloudspot-license-api)\r\n\r\n## CloudspotERP_CompanyAPI\r\n\r\n**This class is used to retrieve data from a company.**\r\n\r\n### Setup\r\n\r\nWhen setting up the class, one parameter is expected: the generated API token of the company.\r\nThis token can be generated by an ERP administrator for a specific company.\r\nA token can have the right to:\r\n- See all products\r\n- See all clients\r\n\r\n```python\r\nfrom cloudspot.api import CloudspotERP_CompanyAPI\r\napi = CloudspotERP_CompanyAPI('[TOKEN]')\r\n```\r\n\r\nAfter setting up the connection, you can use the ```api``` to send requests to the Cloudspot ERP.\r\n\r\n### All products\r\nBelow method will allow you to retrieve all the products that are available inside the ERP and are linked to the company by the token.\r\nThe ```.list()``` method will return one ```Artikels``` object, which is a list containing one or multiple ```Artikel``` objects.\r\n\r\n```python\r\nartikels = api.artikels.list()\r\n\r\nfor artikel in artikels.items():\r\n print('naam: ', artikel.naam)\r\n```\r\n\r\n#### Available attributes\r\n\r\nFollowing attributes are available for the ```Artikel``` object:\r\n\r\n| Attribute | Type | Remarks |\r\n| ------------- | ------------- | ------------- |\r\n| naam | string | Name of the product |\r\n| beschrijving | text | Long description of the product |\r\n| SKU | string | Stock Keeping Unit |\r\n| voorraad_bijhouden | string | Can only contain one of these three values: \"NIET\" / \"FYSIEK\" / \"DIGITAAL\" |\r\n| op_voorraad | float | How many units are currently in stock, only applicable of voorraad_bijhouden is \"FYSIEK\" |\r\n| product_url | url | External URL with the product information |\r\n| verkoopprijs_excl | float | Sales price, excl. VAT |\r\n| verkoopprijs_incl | float | Sales price, incl. VAT |\r\n| inkoopprijs_excl | float | Purchase price, excl. VAT |\r\n| inkoopprijs_incl | float | Purchase price, incl. VAT |\r\n| BTW | float | Percentage of VAT applicable to the product |\r\n| bestellingtype | string | Can only contain one of these two values: \"IDEAAL\" / \"BESTELLING\" |\r\n| units_per_bestelling | float | Minimum amount of units needed for an order to the vendor |\r\n| status | string | Can only contain one of these three values: \"ZICHTBAAR\" / \"NIET_VERKOOPBAAR\" / \"GEDEACTIVEERD\" |\r\n\r\n### Specific product\r\nBelow method will allow you to retrieve a specific product by ID. Will only return the article if the article is in the company that is linked to the token.\r\nThe ```.get(id)``` method will return one ```Artikel``` object.\r\n\r\n```python\r\nartikel = api.artikels.get(125) # Retrieve artikel with ID 125\r\nprint('naam: ', artikel.naam)\r\n```\r\n\r\n### All clients\r\nBelow method will allow you to retrieve all the clients that are available inside the ERP and are linked to the company by the token.\r\nThe ```.list()``` method will return one ```Klanten``` object, which is a list containing one or multiple ```Klant``` objects.\r\n\r\n```python\r\nklanten = api.klanten.list()\r\n\r\nfor klant in klanten.items():\r\n print('voornaam: ', klant.voornaam)\r\n```\r\n\r\n#### Available attributes\r\n\r\nFollowing attributes are available for the ```Klant``` object:\r\n\r\n| Attribute | Type | Remarks |\r\n| ------------- | ------------- | ------------- |\r\n| klantennummer | integer | Client number/reference |\r\n| aanspreektitel | string | Can only contain one of these two values: \"Mijnh.\" / \"Mevr.\" |\r\n| voornaam | string | First name of client |\r\n| achternaam | string | Last name of client |\r\n| straat | string | Street |\r\n| huisnummer | string | House number |\r\n| busnummer | string | Box number |\r\n| postcode | string | Zipcode |\r\n| plaats | string | Place/region |\r\n| land | string | Two letter country code (ex. BE/NL/FR/...) |\r\n| geboortedatum | date | Birthday of client |\r\n| geboorteplaats | string | Place of birth |\r\n| is_bedrijf | boolean | Indicates wether the client is a company or not. True = client is a company, False = client is not a company |\r\n| bedrijfsnaam | string | Name of the company. Only applicable if is_bedrijf is True |\r\n| BTW_nummer | string | VAT number of the company. Only applicable if is_bedrijf is True |\r\n| ondernemingsnummer | string | KBO number of the company. Only applicable if is_bedrijf is True |\r\n\r\n\r\n### Error handling\r\nBasic error handling has been added.\r\nYou can check if an error has occured during a call by checking the hasError attribute on the object.\r\nIf the hasError attribute has been set to True, an Error object will be attached to the error attribute of the same object.\r\nThe Error object contains one attribute: message. This will contain the error message.\r\n\r\n```python\r\nartikels = api.artikels.list()\r\n\r\nif artikels.hasError:\r\n print('error: ', artikels.error.message)\r\n```\r\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "Wrapper for the Cloudspot ERP API endpoints",
"version": "1.1.0",
"project_urls": {
"Download": "https://github.com/Ecosy-EU/cloudspot-api/archive/refs/tags/1.1.0.tar.gz",
"Homepage": "https://github.com/Ecosy-EU/inktool-wrapper"
},
"split_keywords": [
"cloudspot"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "792e5e5f80aad01637d943a73b92f95365b570502a644c2beef42654820673ec",
"md5": "c65c1d95b3ea7a17c44f0d3d0746f5a4",
"sha256": "3804040800d24cdb543c95a830f58f28512c74caf22480664e6b782148a07ee1"
},
"downloads": -1,
"filename": "cloudspot-erp-api-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "c65c1d95b3ea7a17c44f0d3d0746f5a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 22963,
"upload_time": "2023-05-17T06:19:37",
"upload_time_iso_8601": "2023-05-17T06:19:37.975716Z",
"url": "https://files.pythonhosted.org/packages/79/2e/5e5f80aad01637d943a73b92f95365b570502a644c2beef42654820673ec/cloudspot-erp-api-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-05-17 06:19:37",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "Ecosy-EU",
"github_project": "inktool-wrapper",
"github_not_found": true,
"lcname": "cloudspot-erp-api"
}