Tag
A tag is a label that may be attached to almost any resource. While custom fields allow you to attach {key, value}
pairs to various objects in the system, single values can also be
attached to various objects in the system by using tags. There are two categories of tags: System Tags
and User Tags
.
System Tags
: These are interpreted by the system to change its behavior. Certain tags can only be attached to specific resource types -- e.gAccount
. In order to distinguish them from the user tags, the system tags are uppercase symbols.User Tags
: These are defined by the user for any desired purpose and are not interpreted by the system and can be anything as long as it a lowercase symbol. For example,good_customer
could be a tag that can be attached to a customerAccount
.User Tags
must be defined using the Tag Definition APIs. These tags may be attached to almost any resource type.
Kill Bill provides a small set of predefined System Tags
that affect the behavior of the system. For example, AUTO_PAY_OFF
prevents the system from initiating automatic payment of an invoice. System Tags
may be attached only to specific resource types, and most (including AUTO_PAY_OFF
) apply only to Accounts
.
The following system tags have been defined:
Tag | tagDefinitionId | Applicable Object types | Description |
---|---|---|---|
AUTO_PAY_OFF |
00000000-0000-0000-0000-000000000001 |
ACCOUNT |
Suspends payments until removed. |
AUTO_INVOICING_OFF |
00000000-0000-0000-0000-000000000002 |
ACCOUNT |
Suspends invoicing until removed. |
OVERDUE_ENFORCEMENT_OFF |
00000000-0000-0000-0000-000000000003 |
ACCOUNT |
Suspends overdue enforcement behaviour until removed. |
WRITTEN_OFF |
00000000-0000-0000-0000-000000000004 |
INVOICE |
Indicates that an invoice is written off. This has no effect on billing or payment. |
MANUAL_PAY |
00000000-0000-0000-0000-000000000005 |
ACCOUNT |
Indicates that Killbill doesn't process payments for this account. That is, the account uses external payments only. |
TEST |
00000000-0000-0000-0000-000000000006 |
ACCOUNT |
Indicates that this is a test account. |
PARTNER |
00000000-0000-0000-0000-000000000007 |
ACCOUNT |
Indicates that this is a partner account. |
AUTO_INVOICING_DRAFT |
00000000-0000-0000-0000-000000000008 |
ACCOUNT |
Generate account invoices in DRAFT mode. |
AUTO_INVOICING_REUSE_DRAFT |
00000000-0000-0000-0000-000000000009 |
ACCOUNT |
Use existing draft invoice if exists. |
This section provides APIs to list all tags, search for a specific tag, and retrieve tag audit logs. In addition, each resource provides APIs for the applicable CRUD operations: create, read, update and delete.
Tag Resource
A tag resource represents a tag. It has the following attributes:
Name | Type | Generated by | Description |
---|---|---|---|
tagId | string | system | UUID for this specific tag |
objectType | string | user | Type of the object this tag is attached to (e.g. "ACCOUNT") |
objectID | string | system | UUID for the object |
tagDefinitionId | string | system | UUID for the tag definition |
tagDefinitionName | string | user | name for the tag definition |
auditLogs | array | system | array of audit log records for this tag |
List all tags
Retrieves a list of all tags with their associated resources and tag definitions
HTTP Request
GET http://127.0.0.1:8080/1.0/kb/tags/pagination
Query Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
offset | integer | false | 0 | starting item in the list |
limit | integer | false | 100 | number of items to return |
audit | string | false | "NONE" | Level of audit information to return:"NONE", "MINIMAL" (only inserts), or "FULL" |
Returns
If successful, returns a status code of 200 and a list of tag resource objects.
Example Request:
curl \
-u admin:password \
-H "X-Killbill-ApiKey: bob" \
-H "X-Killbill-ApiSecret: lazar" \
-H "Accept: application/json" \
"http://127.0.0.1:8080/1.0/kb/tags/pagination"
Example Response:
[
{
"tagId": "13fe6f2c-91af-4635-aa9c-52e04d99b5ec",
"objectType": "ACCOUNT",
"objectId": "212211f8-a264-4ddf-b609-709ae652aec4",
"tagDefinitionId": "1ac0218e-0d2b-4c65-841f-cff8af92a100",
"tagDefinitionName": "sleepy",
"auditLogs": []
}
]
Search tags
Searches for a specific tag. The search string is compared to the following attributes: tagId, objectType, tagDefinitionName.
HTTP Request
GET http://127.0.0.1:8080/1.0/kb/tags/search/{tagId}
Query Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
offset | integer | false | 0 | starting item in the list |
limit | integer | false | 100 | number of items to return |
audit | string | false | "NONE" | Level of audit information to return:"NONE", "MINIMAL" (only inserts), or "FULL" |
Returns
If successful, returns a status code of 200 and a list of tag resource objects that contain a match for the specified search key.
Example Request:
curl \
-u admin:password \
-H "X-Killbill-ApiKey: bob" \
-H "X-Killbill-ApiSecret: lazar" \
-H "Accept: application/json" \
"http://127.0.0.1:8080/1.0/kb/tags/search/13fe6f2c-91af-4635-aa9c-52e04d99b5ec"
Example Response:
[
{
"tagId": "13fe6f2c-91af-4635-aa9c-52e04d99b5ec",
"objectType": "ACCOUNT",
"objectId": "212211f8-a264-4ddf-b609-709ae652aec4",
"tagDefinitionId": "1ac0218e-0d2b-4c65-841f-cff8af92a100",
"tagDefinitionName": "sleepy",
"auditLogs": []
}
]
Retrieve tag audit logs
Retrieve a list of audit log records showing changes to the tag. History information (a copy of the full tag object) is included with each record.
HTTP Request
GET http://127.0.0.1:8080/1.0/kb/tags/{tagId}/auditLogsWithHistory
Query Parameters
None.
Returns
If successful, returns a status code of 200 and a list of audit log objects.
Example Request:
curl \
-u admin:password \
-H "X-Killbill-ApiKey: bob" \
-H "X-Killbill-ApiSecret: lazar" \
-H "Accept: application/json" \
"http://127.0.0.1:8080/1.0/kb/tags/26e22dbf7-a493-4402-b1e3-4bec54c39f31/auditLogsWithHistory"
Example Response:
[
{
"changeType": "INSERT",
"changeDate": "2013-09-01T06:00:05.000Z",
"objectType": "TAG",
"objectId": "6e22dbf7-a493-4402-b1e3-4bec54c39f31",
"changedBy": "test_fixed_and_recurrring_items",
"reasonCode": null,
"comments": "Closing account",
"userToken": "06d4fa80-f6ab-4760-aa97-2cd4ab83fd37",
"history": {
"id": null,
"createdDate": "2013-09-01T06:00:05.000Z",
"updatedDate": "2013-09-01T06:00:05.000Z",
"recordId": 1,
"accountRecordId": 11,
"tenantRecordId": 2,
"tagDefinitionId": "00000000-0000-0000-0000-000000000002",
"objectId": "037a6b81-f351-4e09-b2ea-f76f2fb0189e",
"objectType": "ACCOUNT",
"isActive": true,
"tableName": "TAG",
"historyTableName": "TAG_HISTORY"
}
}
]