Services & Products¶
15 endpoints. Authentication, errors, paging and rate limits are described once, in the API overview.
| Action | Method | Description |
|---|---|---|
addcancelrequest |
POST | Request cancellation of a service |
addproduct |
POST | Create a new product/package |
getcancelledpackages |
GET | List cancellation requests |
getclientsaddons |
GET | Get all addons for a client |
getclientsproducts |
GET | List services/products for a client |
modulechangepackage |
POST | Run Change Package on a service module |
modulechangepw |
POST | Change the account password on the server |
modulecreate |
POST | Run the module Create function for a service |
modulecustom |
POST | Run a custom function of a server module |
modulesuspend |
POST | Suspend a hosting service |
moduleterminate |
POST | Run the module Terminate function |
moduleunsuspend |
POST | Unsuspend/reactivate a service |
updateclientaddon |
POST | Update a service addon |
updateclientproduct |
POST | Update a client's hosting service record |
upgradeproduct |
POST | Move a service to another product, billing the difference |
addcancelrequest¶
Request cancellation of a service.
POST /api/v1/addcancelrequest
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
type |
string | no | Immediate, or End of Billing Period (the default). |
reason |
string | no | Up to 1000 characters. |
Response
| Field | Description |
|---|---|
result |
success |
serviceid |
integer |
Errors
| Status | When |
|---|---|
| 404 | No such service. |
| 409 | A request is already open for it. |
| 422 | The service is terminated, cancelled or fraud. |
Example
curl -X POST https://example.com/api/v1/addcancelrequest \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1"
addproduct¶
Create a new product/package.
POST /api/v1/addproduct
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Up to 255 characters. |
gid |
integer | yes | The product group. |
type |
string | yes | hostingaccount, reselleraccount, server or other (hosting, reseller, vps, ssl, other are accepted too). |
paytype |
string | yes | free, onetime or recurring. |
description |
string | no | Description. |
module |
string | no | The server module that provisions it, for example panelica. |
servergroupid |
integer | no | The server group. |
autosetup |
string | no | order (set up when ordered; on is accepted too), payment, or manual. |
package_name |
string | no | The package on the server. |
pricing |
object | no | pricing[currencyid][cycle]=price, cycles monthly to triennially; -1 means not sold on that cycle. |
Response
| Field | Description |
|---|---|
result |
success |
pid |
integer |
Note
Created as the product screen creates it.
Example
curl -X POST https://example.com/api/v1/addproduct \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "name=Starter" \
--data-urlencode "gid=1" \
--data-urlencode "type=hostingaccount" \
--data-urlencode "paytype=recurring" \
--data-urlencode "module=panelica" \
--data-urlencode "pricing[1][monthly]=4.99"
getcancelledpackages¶
List cancellation requests.
GET /api/v1/getcancelledpackages
Permission: list_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
limitstart |
integer | no | Where the page starts. Default 0. |
limitnum |
integer | no | Page size, 1 to 250. Default 25. |
Response
| Field | Description |
|---|---|
result |
success |
totalresults |
integer: rows matching the filters |
startnumber |
integer: where this page starts |
numreturned |
integer: rows on this page |
data |
array: the rows |
Note
The cancellation requests, newest first, each with its service.
Example
curl -G https://example.com/api/v1/getcancelledpackages \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET"
getclientsaddons¶
Get all addons for a client.
GET /api/v1/getclientsaddons
Permission: list_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
clientid |
integer | no | Only this client's addons. userid is accepted too. |
serviceid |
integer | no | Only this service's addons. |
Response
| Field | Description |
|---|---|
result |
success |
addons |
array of service addons, each with its service and addon |
Example
curl -G https://example.com/api/v1/getclientsaddons \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET"
getclientsproducts¶
List services/products for a client.
GET /api/v1/getclientsproducts
Permission: list_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
clientid |
integer | no | Only this client's services. userid is accepted too. |
serviceid |
integer | no | One service. |
pid |
integer | no | Only services of this product. |
domain |
string | no | Only the service for this exact domain. |
status |
string | no | pending, active, suspended, terminated, cancelled, fraud or completed. |
limitstart |
integer | no | Where the page starts. Default 0. |
limitnum |
integer | no | Page size, 1 to 250. Default 25. |
Response
| Field | Description |
|---|---|
result |
success |
totalresults |
integer: rows matching the filters |
startnumber |
integer: where this page starts |
numreturned |
integer: rows on this page |
data |
array: the rows |
Note
Each service carries its client and product.
Example
curl -G https://example.com/api/v1/getclientsproducts \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET"
modulechangepackage¶
Run Change Package on a service module.
POST /api/v1/modulechangepackage
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
packageid |
integer | yes | The product to move the account to. |
Response
| Field | Description |
|---|---|
result |
success |
Errors
| Status | When |
|---|---|
| 400 | The server module refused. |
| 404 | No such service or product. |
Note
Changes the plan on the server only; billing is not touched. To bill the difference, use upgradeproduct.
Example
curl -X POST https://example.com/api/v1/modulechangepackage \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1" \
--data-urlencode "packageid=1"
modulechangepw¶
Change the account password on the server.
POST /api/v1/modulechangepw
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
servicepassword |
string | yes | The new password, at least 6 characters. password is accepted too. |
Response
| Field | Description |
|---|---|
result |
success |
Errors
| Status | When |
|---|---|
| 400 | No password was sent, or the server module refused. |
| 404 | No such service. |
Example
curl -X POST https://example.com/api/v1/modulechangepw \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1" \
--data-urlencode "servicepassword=example"
modulecreate¶
Run the module Create function for a service.
POST /api/v1/modulecreate
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
Response
| Field | Description |
|---|---|
result |
success |
(module fields) |
whatever the server module reports, such as message |
Errors
| Status | When |
|---|---|
| 400 | The server module refused; message says why. |
| 404 | No such service. |
Note
Creates the account on the server through the product's server module.
Example
curl -X POST https://example.com/api/v1/modulecreate \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1"
modulecustom¶
Run a custom function of a server module.
POST /api/v1/modulecustom
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
func_name |
string | yes | A function the service's server module lists in customFunctions(). |
Response
| Field | Description |
|---|---|
result |
success |
Errors
| Status | When |
|---|---|
| 404 | No such service, or its module offers no function by that name (the message lists the ones it offers). |
| 422 | The function ran and reported a failure. |
| 502 | The function failed. |
Note
None of the built-in server modules offers a custom function; this is for third-party modules.
Example
curl -X POST https://example.com/api/v1/modulecustom \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1" \
--data-urlencode "func_name=example"
modulesuspend¶
Suspend a hosting service.
POST /api/v1/modulesuspend
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
reason |
string | no | Stored as the suspension reason and passed to the server module. |
Response
| Field | Description |
|---|---|
result |
success |
Errors
| Status | When |
|---|---|
| 400 | The server module refused. |
| 404 | No such service. |
Example
curl -X POST https://example.com/api/v1/modulesuspend \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1"
moduleterminate¶
Run the module Terminate function.
POST /api/v1/moduleterminate
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
Response
| Field | Description |
|---|---|
result |
success |
Errors
| Status | When |
|---|---|
| 400 | The server module refused. |
| 404 | No such service. |
Note
Deletes the account on the server. It cannot be undone.
Example
curl -X POST https://example.com/api/v1/moduleterminate \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1"
moduleunsuspend¶
Unsuspend/reactivate a service.
POST /api/v1/moduleunsuspend
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
Response
| Field | Description |
|---|---|
result |
success |
Errors
| Status | When |
|---|---|
| 400 | The server module refused. |
| 404 | No such service. |
Example
curl -X POST https://example.com/api/v1/moduleunsuspend \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1"
updateclientaddon¶
Update a service addon.
POST /api/v1/updateclientaddon
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
id |
integer | yes | The service addon. |
status |
string | no | pending, active, suspended, terminated, cancelled, fraud or completed. cancelled stops its billing too. |
notes |
string | no | Notes. |
Response
| Field | Description |
|---|---|
result |
success |
addonid |
integer |
Errors
| Status | When |
|---|---|
| 404 | No such addon. |
Example
curl -X POST https://example.com/api/v1/updateclientaddon \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "id=1"
updateclientproduct¶
Update a client's hosting service record.
POST /api/v1/updateclientproduct
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
status |
string | no | pending, active, suspended, terminated, cancelled, fraud or completed. |
domain |
string | no | A domain name. |
username |
string | no | The account user name on the server. |
password |
string | no | The account password as stored in PNLCS. This does not change it on the server; use modulechangepw for that. |
next_due_date |
date | no | Next due date. |
billing_cycle |
string | no | onetime, monthly, quarterly, semiannually, annually, biennially or triennially. |
notes |
string | no | Admin notes. |
Response
| Field | Description |
|---|---|
result |
success |
serviceid |
integer |
Errors
| Status | When |
|---|---|
| 404 | No such service. |
Note
Changes the record only; nothing is sent to the server.
Example
curl -X POST https://example.com/api/v1/updateclientproduct \
-H "X-API-Key: $PNLCS_IDENTIFIER" \
-H "X-API-Secret: $PNLCS_SECRET" \
--data-urlencode "serviceid=1"
upgradeproduct¶
Move a service to another product, billing the difference.
POST /api/v1/upgradeproduct
Permission: manage_services
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
serviceid |
integer | yes | The service. |
packageid |
integer | yes | The new product. |
Response
| Field | Description |
|---|---|
result |
success |
serviceid |
integer |
upgradeid |
integer |
invoiceid |
integer or null: the invoice for the difference |
applied |
boolean: true when the change was made at once (nothing to pay) |
Errors
| Status | When |
|---|---|
| 422 | The change is not allowed: the product keeps its customers on it, does not offer the new package, the new package uses another module, or what the account has does not fit the new package (the message says what to remove). |
Note
The same upgrade the client area offers: the difference is billed, and the server is changed once it is paid.
Example