Variables

For the purpose of this test, we have a client company:

Response: HTTP 200, application/json (Hide)
GET /companies/2

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
    "single": {
        "id": 2,
        "class": "Company",
        "url_path": "\/companies\/2",
        "name": "Client Company GmbH",
        "members": [],
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "is_archived": false,
        "created_on": 1430164861,
        "created_by_id": 1,
        "updated_on": 1430164861,
        "updated_by_id": 1,
        "address": "Street Name 12\nCity",
        "phone": null,
        "homepage_url": null,
        "tax_id": null,
        "currency_id": 1,
        "is_owner": false,
        "has_note": false
    },
    "hourly_rates": {
        "1": 100
    },
    "active_projects_count": 0
}

ActiveCollab allows following variables to be used in recurring profile items and notes:

  • {day}
  • {month}
  • {next_month}
  • {previous_month}
  • {quarter}
  • {next_quarter}
  • {previous_quarter}
  • {year}
  • {next_year}
  • {previous_year}
Response: HTTP 200, application/json (Hide)
POST /recurring-profiles

Payload:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
{
    "name": "Test Profile",
    "start_on": "2015-04-27",
    "frequency": "daily",
    "occurrences": 1,
    "is_enabled": true,
    "company_id": 2,
    "items": [
        {
            "description": "Quarter of year: {quarter}\/{year}",
            "quantity": 100,
            "unit_cost": 25
        },
        {
            "description": "Month: {month}",
            "quantity": 250,
            "unit_cost": 13,
            "first_tax_rate_id": 1
        },
        {
            "description": "Today: {day}",
            "quantity": 15,
            "unit_cost": 25
        }
    ],
    "note": "Variables can be used in notes as well. This is previous year: {previous_year}",
    "private_note": "And this is next year: {next_year}"
}

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
{
    "single": {
        "id": 1,
        "class": "RecurringProfile",
        "url_path": "\/recurring-profiles\/1",
        "name": "Test Profile",
        "company_id": 2,
        "company_name": "Client Company GmbH",
        "company_address": "Street Name 12\nCity",
        "note": "Variables can be used in notes as well. This is previous year: {previous_year}",
        "currency_id": 1,
        "language_id": 0,
        "discount_rate": 0,
        "subtotal": 6125,
        "subtotal_without_discount": 6125,
        "discount": 0,
        "tax": 568.75,
        "rounding_difference": 0,
        "rounded_total": 6693.75,
        "total": 6693.75,
        "paid_amount": 0,
        "balance_due": 6693.75,
        "recipients": null,
        "email_from": null,
        "email_subject": null,
        "email_body": null,
        "second_tax_is_enabled": false,
        "second_tax_is_compound": false,
        "created_on": 1430164861,
        "created_by_id": 1,
        "project_id": 0,
        "purchase_order_number": null,
        "start_on": 1430092800,
        "last_trigger_on": null,
        "next_trigger_on": 1430092800,
        "frequency": "daily",
        "occurrences": 1,
        "triggered_number": 0,
        "stored_card_id": 0,
        "auto_issue": false,
        "is_enabled": true,
        "is_completed": false,
        "private_note": "And this is next year: {next_year}",
        "invoice_due_after": 15
    },
    "items": [
        {
            "id": 1,
            "class": "InvoiceItem",
            "url_path": "\/invoice-items\/1",
            "parent_type": "RecurringProfile",
            "parent_id": 1,
            "discount_rate": 0,
            "description": "Quarter of year: {quarter}\/{year}",
            "quantity": 100,
            "unit_cost": 25,
            "first_tax_rate_id": 0,
            "first_tax_value": 0,
            "first_tax_name": "",
            "first_tax_rate": 0,
            "second_tax_rate_id": 0,
            "second_tax_value": 0,
            "second_tax_name": "",
            "second_tax_rate": 0,
            "second_tax_is_enabled": false,
            "second_tax_is_compound": false,
            "subtotal": 2500,
            "subtotal_without_discount": 2500,
            "discount": 0,
            "total": 2500,
            "position": 1
        },
        {
            "id": 2,
            "class": "InvoiceItem",
            "url_path": "\/invoice-items\/2",
            "parent_type": "RecurringProfile",
            "parent_id": 1,
            "discount_rate": 0,
            "description": "Month: {month}",
            "quantity": 250,
            "unit_cost": 13,
            "first_tax_rate_id": 1,
            "first_tax_value": 568.75,
            "first_tax_name": "VAT",
            "first_tax_rate": 17.5,
            "second_tax_rate_id": 0,
            "second_tax_value": 0,
            "second_tax_name": "",
            "second_tax_rate": 0,
            "second_tax_is_enabled": false,
            "second_tax_is_compound": false,
            "subtotal": 3250,
            "subtotal_without_discount": 3250,
            "discount": 0,
            "total": 3818.75,
            "position": 2
        },
        {
            "id": 3,
            "class": "InvoiceItem",
            "url_path": "\/invoice-items\/3",
            "parent_type": "RecurringProfile",
            "parent_id": 1,
            "discount_rate": 0,
            "description": "Today: {day}",
            "quantity": 15,
            "unit_cost": 25,
            "first_tax_rate_id": 0,
            "first_tax_value": 0,
            "first_tax_name": "",
            "first_tax_rate": 0,
            "second_tax_rate_id": 0,
            "second_tax_value": 0,
            "second_tax_name": "",
            "second_tax_rate": 0,
            "second_tax_is_enabled": false,
            "second_tax_is_compound": false,
            "subtotal": 375,
            "subtotal_without_discount": 375,
            "discount": 0,
            "total": 375,
            "position": 3
        }
    ],
    "stored_card": null,
    "invoices": []
}

Now when we trigger the profile, it will create one invoice:

Response: HTTP 200, application/json (Hide)
POST /recurring-profiles/trigger

Payload:

1
2
3
{
    "date": "2015-04-27"
}

Response:

1
2
3
[
    1
]
Response: HTTP 200, application/json (Hide)
GET /invoices/1

Response:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
{
    "single": {
        "id": 1,
        "class": "Invoice",
        "url_path": "\/invoices\/1",
        "is_trashed": false,
        "trashed_on": null,
        "trashed_by_id": 0,
        "company_id": 2,
        "company_name": "Client Company GmbH",
        "company_address": "Street Name 12\nCity",
        "note": "Variables can be used in notes as well. This is previous year: 2014",
        "currency_id": 1,
        "language_id": 0,
        "discount_rate": 0,
        "subtotal": 6125,
        "subtotal_without_discount": 6125,
        "discount": 0,
        "tax": 568.75,
        "rounding_difference": 0,
        "rounded_total": 6693.75,
        "total": 6693.75,
        "paid_amount": 0,
        "balance_due": 6693.75,
        "recipients": null,
        "email_from": null,
        "email_subject": null,
        "email_body": null,
        "second_tax_is_enabled": false,
        "second_tax_is_compound": false,
        "created_on": 1430164861,
        "created_by_id": 1,
        "updated_on": 1430164862,
        "based_on_type": "RecurringProfile",
        "based_on_id": 1,
        "number": "1",
        "project_id": 0,
        "purchase_order_number": null,
        "issued_on": 1430092800,
        "due_on": 1430092800,
        "allow_payments": 1,
        "closed_on": null,
        "sent_on": null,
        "hash": "7WIHhIYdByXomb9fRuJhzEvLCuYXf0S3Hp0edbGB",
        "status": "issued",
        "public_url": "http:\/\/feather.dev\/s\/invoice?hash=7WIHhIYdByXomb9fRuJhzEvLCuYXf0S3Hp0edbGB&number=1",
        "is_credit_invoice": false
    },
    "reminders": [],
    "items": [
        {
            "id": 4,
            "class": "InvoiceItem",
            "url_path": "\/invoice-items\/4",
            "parent_type": "Invoice",
            "parent_id": 1,
            "discount_rate": 0,
            "description": "Quarter of year: 2\/2015",
            "quantity": 100,
            "unit_cost": 25,
            "first_tax_rate_id": 0,
            "first_tax_value": 0,
            "first_tax_name": "",
            "first_tax_rate": 0,
            "second_tax_rate_id": 0,
            "second_tax_value": 0,
            "second_tax_name": "",
            "second_tax_rate": 0,
            "second_tax_is_enabled": false,
            "second_tax_is_compound": false,
            "subtotal": 2500,
            "subtotal_without_discount": 2500,
            "discount": 0,
            "total": 2500,
            "position": 1,
            "time_record_ids": [],
            "expense_ids": []
        },
        {
            "id": 5,
            "class": "InvoiceItem",
            "url_path": "\/invoice-items\/5",
            "parent_type": "Invoice",
            "parent_id": 1,
            "discount_rate": 0,
            "description": "Month: April",
            "quantity": 250,
            "unit_cost": 13,
            "first_tax_rate_id": 1,
            "first_tax_value": 568.75,
            "first_tax_name": "VAT",
            "first_tax_rate": 17.5,
            "second_tax_rate_id": 0,
            "second_tax_value": 0,
            "second_tax_name": "",
            "second_tax_rate": 0,
            "second_tax_is_enabled": false,
            "second_tax_is_compound": false,
            "subtotal": 3250,
            "subtotal_without_discount": 3250,
            "discount": 0,
            "total": 3818.75,
            "position": 2,
            "time_record_ids": [],
            "expense_ids": []
        },
        {
            "id": 6,
            "class": "InvoiceItem",
            "url_path": "\/invoice-items\/6",
            "parent_type": "Invoice",
            "parent_id": 1,
            "discount_rate": 0,
            "description": "Today: Apr 27. 2015",
            "quantity": 15,
            "unit_cost": 25,
            "first_tax_rate_id": 0,
            "first_tax_value": 0,
            "first_tax_name": "",
            "first_tax_rate": 0,
            "second_tax_rate_id": 0,
            "second_tax_value": 0,
            "second_tax_name": "",
            "second_tax_rate": 0,
            "second_tax_is_enabled": false,
            "second_tax_is_compound": false,
            "subtotal": 375,
            "subtotal_without_discount": 375,
            "discount": 0,
            "total": 375,
            "position": 3,
            "time_record_ids": [],
            "expense_ids": []
        }
    ],
    "time_records": [],
    "expenses": [],
    "payments": []
}
Response: HTTP 200, application/json (Hide)
GET /invoices/private-notes

Response:

1
2
3
{
    "1": "And this is next year: 2016"
}