Returns a record of the invoice that corresponds with the provided ID
https://api.constructiononline.com/Invoices?id={id}
This endpoint allows users to extract a specific invoice from their ConstructionOnline company account. Users must know the unique ID assigned to the invoice to call this endpoint.
Requests
REQUIRED PARAMETERS
id: integer
- Unique identifier for the invoice.
Sample URL request:
- https://api.constructiononline.com/api/Invoices?id=34313
Example requests in cURL, C#, Python, and JavaScript can be found below:
cURL
# replace {email} with the email address for your ConstructionOnline account
# {password} with your ConstructionOnline password
# {apikey} with your provided API key
# {id} with the invoice's ID
curl https://api.constructiononline.com/api/Invoices?id={id} -u {email}:{password} -H 'APIKey:{apikey}'
C#
/* replace {username} with the email address for your ConstructionOnline account
{password} with your ConstructionOnline password
{apikey} with your provided API key
{id} with the invoice's ID */
public string GetData(string endpoint) {
string username = "{username}";
string password = "{password}";
string apikey = "{apikey}";
HttpResponseMessage response = null;
HttpClientHandler handler = new HttpClientHandler() { AutomaticDecompression = System.Net.DecompressionMethods.GZip };
using (HttpClient client = new HttpClient(handler)) {
client.Timeout = new TimeSpan(0, 0, 30);
client.BaseAddress = new Uri("http://api.constructiononline.com");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic",
System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(username + ":" + password)));
client.DefaultRequestHeaders.Add("APIKey", apikey);
client.DefaultRequestHeaders.Add("Accept-Encoding", "gzip");
response = client.GetAsync(endpoint).Result;
}
return response?.Content.ReadAsStringAsync().Result;
}
MessageBox.Show(GetData("api/Invoices?id={id}"));
Python
#replace {username} with the email address for your ConstructionOnline account
#{password} with your ConstructionOnline password
#{apikey} with your provided API key
#{id} with the invoice's ID
import base64, requests, json
apikey = "{apikey}"
username = "{username}"
password = "{password}"
def makeRequest(endpoint):
url = "https://api.constructiononline.com/" + endpoint
userPass = username + ":" + password
headers = {
"APIKey": apikey,
"Accept-Encoding": "gzip, deflate, br",
"Authorization": "Basic " + base64.b64encode(userPass.encode()).decode(),
}
response = requests.get(url, headers=headers)
return json.dumps(json.loads(response.text), indent=2)
#Main Program
print(makeRequest("api/Invoices?id={id}"))
JavaScript
/* replace {username} with the email address for your ConstructionOnline account
{password} with your ConstructionOnline password
{apikey} with your provided API key
{id} with the invoice's ID */
username = '{username}';
password = '{password}';
apikey = '{apikey}';
function makeRequest(endpoint) {
auth = btoa('${username}:${password}');
var myHeaders = new Headers();
myHeaders.append("APIKey", apikey);
myHeaders.append("Accept-Encoding", "gzip, deflate, br");
myHeaders.append("Authorization", "Basic ${auth}");
var requestOptions = {
method: 'GET',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.constructiononline.com/" + endpoint, requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
return response;
};makeRequest("api/Invoices?id={id}");
Responses
200: Success
A successful request will return a 200 response with the requested invoice in the body, as seen below. Definitions for all returned properties can be found here.
{ "ID": 34313,
"PRJ_ID": 1432504,
"INV_NUMBER": "0",
"INV_DATE": "2024-09-26T05:00:00",
"TOTAL": 1391283.9700000002,
"RETAINAGE": 0.0,
"LMOD": "2024-09-26T21:40:24.67",
"STATUS": 3,
"ACCT_INT_ID": "",
"SENT_TO_ACCT_INT_VALUE": 0.0,
"SENT_TO_ACCT_INT_COM": 0.0,
"COMPANY_ID": 23573,
"CORDER_ID": 0,
"COM_PRORATED": true,
"DATE_CREATED": "2024-09-26T16:40:24.67",
"CREATED_BY": 885048,
"LMOD_BY": 885048,
"ACCT_INT_SENT_DATE": null,
"PAID_AMOUNT": 0.0,
"PAID_DATE": null,
"TITLE": "Pre-Construction Fees",
"NOTES": "",
"DUE_DATE": "2024-09-26T05:00:00",
"CLIENT_ID": 906920,
"TERM_ID": 0,
"TOTAL_COM": 0.0,
"FROM_ACCT_INT": false,
"DATE_EMAILED": null,
"REFERENCE_ID": "1432504-001",
"ITEMS": [
{
"ID": 246078,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01000 - General Conditions",
"DESCRIPTION": "",
"TOTAL": 53270.3,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 53270.3,
"ITEM_ID": 32992293,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246079,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01001 - Project Permits & Fees",
"DESCRIPTION": "",
"TOTAL": 11081.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 11081.0,
"ITEM_ID": 32992294,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246080,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01025 - Admin & Supervision",
"DESCRIPTION": "",
"TOTAL": 67000.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 67000.0,
"ITEM_ID": 32992295,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246081,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01500 - Sanitary & Waste",
"DESCRIPTION": "",
"TOTAL": 3900.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 3900.0,
"ITEM_ID": 32992296,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246082,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01510 - Temporary Utilities",
"DESCRIPTION": "",
"TOTAL": 28021.14,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 28021.14,
"ITEM_ID": 32992297,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246083,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01550 - Mobilization & Aids",
"DESCRIPTION": "",
"TOTAL": 6000.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 6000.0,
"ITEM_ID": 32992298,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246084,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01650 - Local Conditions Labor",
"DESCRIPTION": "",
"TOTAL": 5877.86,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 5877.86,
"ITEM_ID": 32992299,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246085,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01675 - Construction Tools and Equip",
"DESCRIPTION": "",
"TOTAL": 33000.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 33000.0,
"ITEM_ID": 32992300,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246086,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01800 - Cleaning Subcontract",
"DESCRIPTION": "",
"TOTAL": 3700.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 3700.0,
"ITEM_ID": 32992302,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246087,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 01 Gen. Requirements:01850 - Cleaning & Common Labor",
"DESCRIPTION": "",
"TOTAL": 3500.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 3500.0,
"ITEM_ID": 32992303,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246088,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 02 Site Work:02000 - Exterior Site Sub",
"DESCRIPTION": "",
"TOTAL": 760880.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 760880.0,
"ITEM_ID": 32992305,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246089,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 02 Site Work:02025 - Exterior Site Mat",
"DESCRIPTION": "",
"TOTAL": 6337.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 6337.0,
"ITEM_ID": 32992306,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246090,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 02 Site Work:02050 - Exterior Site Lab",
"DESCRIPTION": "",
"TOTAL": 5000.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 5000.0,
"ITEM_ID": 32992307,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246091,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 02 Site Work:02125 - Common Consumable Mat",
"DESCRIPTION": "",
"TOTAL": 4167.67,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 4167.67,
"ITEM_ID": 32992308,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246092,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 02 Site Work:02500 - Site Utility Sub",
"DESCRIPTION": "",
"TOTAL": 395049.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 395049.0,
"ITEM_ID": 32992309,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
},
{
"ID": 246093,
"PRJ_ID": 1432504,
"INV_ID": 34313,
"NAME": "Div 02 Site Work:02800 - Pavement Marking Sub",
"DESCRIPTION": "",
"TOTAL": 4500.0,
"RETAINAGE": 0.0,
"MARGIN": 0.0,
"QTY": 1.0,
"RATE": 4500.0,
"ITEM_ID": 32992310,
"ITEM_TYPE": 1,
"PAID_AMOUNT": 0.0
}
]
}
404: Error
The server was not able to locate the resource specified in the request.
429: Error
The user has surpassed the request rate limit for the hour, day, week, or month.
500: Error
There was an internal server error and the server was unable to complete the request.
Last updated: Oct 30, 2024