Get all Purchase Orders

Returns a record of all purchase orders within your ConstructionOnline company account

get https://api.constructiononline.com/PurchaseOrders

This endpoint allows users to extract a record of all purchase orders from their ConstructionOnline company account.

Requests

Sample URL request:

  • https://api.constructiononline.com/api/PurchaseOrders

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

curl https://api.constructiononline.com/api/PurchaseOrders -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 */

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/PurchaseOrders"));

Python

#replace {username} with the email address for your ConstructionOnline account
#{password} with your ConstructionOnline password
#{apikey} with your provided API key

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/PurchaseOrders"))

JavaScript

/* replace {username} with the email address for your ConstructionOnline account
{password} with your ConstructionOnline password
{apikey} with your provided API key */

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/PurchaseOrders");

Responses

green 200: Success

A successful request will return a 200 response with the requested purchase orders in the body, as seen below. Definitions for all returned properties can be found here. 

{        "ID": 2392,
        "TITLE": "PO# 1432504-000",
        "PO_NUMBER": "1432504-000",
        "PRJ_ID": 1432504,
        "PRJ_NAME": "24-613 UTC DE Remarket Center",
        "FROM_SCRATCH": false,
        "ACTIVE": true,
        "DATE_CREATED": "2024-09-13T14:34:50.423",
        "CREATED_BY": 885048,
        "DUE_DATE": "2024-09-15T00:00:00",
        "START_DATE": "2024-10-02T00:00:00",
        "COMPLETION_DATE": "2024-10-05T00:00:00",
        "DELIVERY_DATE": "2024-09-30T00:00:00",
        "SUBTOTAL": 92320.0,
        "TOTAL": 92320.0,
        "AMOUNT_BILLED": 92320.0,
        "AMOUNT_PAID": 92320.0,
        "PAID_IN_FULL": true,
        "VENDOR_ID": 1551562,
        "LMOD": "2024-09-13T19:35:41.907",
        "LMOD_BY": 885048,
        "APPROVAL_STATUS": 2,
        "APPROVER": 0,
        "APPROVAL_DATE": "2024-09-13T14:34:50.423",
        "VERIFICATION_STATUS": 0,
        "VERIFIER": 0,
        "VERIFICATION_DATE": null,
        "INT_NOTES": "",
        "SCOPE_OF_WORK": "%3Ch3%3E%3Cstrong%3EScope of Work for HVAC Purchase Order%3C%2Fstrong%3E%3C%2Fh3%3E%0A%3Cp%3E%3Cstrong%3E1. Project Overview%3C%2Fstrong%3E%3C%2Fp%3E%0A%3Cp%3EThis document outlines the work needed to supply and install heating and air conditioning systems for the residential property located at 123 Maple Street.%3C%2Fp%3E%0A%3Cp%3E%3C%2Fp%3E%0A%3Cp%3E%3Cstrong%3E2. Objectives%3C%2Fstrong%3E%3C%2Fp%3E%0A%3Cul%3E%3Cli%3ESupply and install HVAC equipment.%3C%2Fli%3E%3Cli%3EEnsure the system operates correctly and meets all required standards.%3C%2Fli%3E%3C%2Ful%3E%0A%3Cp%3E%3Cstrong%3E3. Deliverables%3C%2Fstrong%3E%3C%2Fp%3E%0A%3Cul%3E%3Cli%3E%3Cstrong%3EEquipment Supply%3A%3C%2Fstrong%3E%3Cul%3E%3Cli%3EHeating unit%3A Gas furnace%2C 80%2C000 BTU%3C%2Fli%3E%3Cli%3ECooling unit%3A Central air conditioner%2C 5-ton capacity%3C%2Fli%3E%3Cli%3EThermostats%3A Programmable%2C Wi-Fi enabled%3C%2Fli%3E%3C%2Ful%3E%3C%2Fli%3E%3Cli%3E%3Cstrong%3EInstallation Services%3A%3C%2Fstrong%3E%3Cul%3E%3Cli%3ERemove existing HVAC equipment.%3C%2Fli%3E%3Cli%3EInstall new heating and cooling units.%3C%2Fli%3E%3Cli%3ETest the system to ensure proper operation and efficiency.%3C%2Fli%3E%3C%2Ful%3E%3C%2Fli%3E%3C%2Ful%3E%0A%3Cp%3E%3Cstrong%3E4. Schedule%3C%2Fstrong%3E%3C%2Fp%3E%0A%3Cul%3E%3Cli%3E%3Cstrong%3EOrder Date%3A%3C%2Fstrong%3E%26nbsp%3BSeptember 15%2C 2024%3C%2Fli%3E%3Cli%3E%3Cstrong%3EDelivery Date%3A%3C%2Fstrong%3E%26nbsp%3BSeptember 30%2C 2024%3C%2Fli%3E%3Cli%3E%3Cstrong%3EInstallation Start%3A%3C%2Fstrong%3E%26nbsp%3BOctober 2%2C 2024%3C%2Fli%3E%3Cli%3E%3Cstrong%3ECompletion Date%3A%3C%2Fstrong%3E%26nbsp%3BOctober 5%2C 2024%3C%2Fli%3E%3C%2Ful%3E%0A%3Cp%3E%3Cstrong%3E5. Responsibilities%3C%2Fstrong%3E%3C%2Fp%3E%0A%3Cul%3E%3Cli%3E%3Cstrong%3EContractor%3A%3C%2Fstrong%3E%26nbsp%3BProvide and install the HVAC equipment%2C ensure proper functionality%2C and comply with all relevant standards.%3C%2Fli%3E%3Cli%3E%3Cstrong%3EClient%3A%3C%2Fstrong%3E%26nbsp%3BProvide access to the property and make payments as outlined.%3C%2Fli%3E%3C%2Ful%3E%0A%3Cp%3E%3Cstrong%3E6. Contact Information%3C%2Fstrong%3E%3C%2Fp%3E%0A%3Cul%3E%3Cli%3E%3Cstrong%3EContractor%3A%3C%2Fstrong%3E%26nbsp%3BBrian Sanderson%2C United Heating and Air%3Cul%3E%3Cli%3EPhone%3A (555) 642-2003%3C%2Fli%3E%3Cli%3EEmail%3A%26nbsp%3Bbsanderson%40udatraining.com%3C%2Fli%3E%3C%2Ful%3E%3C%2Fli%3E%3Cli%3E%3Cstrong%3EClient%3A%3C%2Fstrong%3E%26nbsp%3BCole Whaley%3Cul%3E%3Cli%3EPhone%3A (555) 366-1122%3C%2Fli%3E%3Cli%3EEmail%3A cwhaley%40udatraining.com%3C%2Fli%3E%3C%2Ful%3E%3C%2Fli%3E%3C%2Ful%3E",
        "TRADE": 75300,
        "TRADE_NAME": "HVAC",
        "PO_TYPE": 105756,
        "TYPE_NAME": "po_MaterialAndLabor",
        "TRAFFIC_COLOR": 0,
        "ITEMS": [
            {
                "ID": 45342,
                "PO_ID": 2392,
                "RELATED_ITEM_ID": 91401849,
                "ORG_RELATED_ITEM_ID": 91401849,
                "RELATED_ITEM_TYPE": 0,
                "IS_ADDITIONAL_ITEM": false,
                "COST_CODE_ID": 0,
                "TAX_TYPE_ID": 0,
                "TAX_PERCENT": 0.0,
                "NAME": "HVAC Subcontract",
                "DESCRIPTION": "",
                "QTY": 1.0,
                "UNIT": 90055,
                "UNIT_NAME": "per unit",
                "RATE": 92320.0,
                "SUBTOTAL": 92320.0,
                "TOTAL": 92320.0,
                "AMOUNT_BILLED": 92320.0,
                "AMOUNT_BILLED_NO_TAX": 92320.0,
                "AMOUNT_PAID": 92320.0,
                "AMOUNT_PAID_NO_TAX": 92320.0
            }
        ]
    }

red 404: Error

The server was not able to locate the resource specified in the request.

red 429: Error

The user has surpassed the request rate limit for the hour, day, week, or month.

 red 500: Error

There was an internal server error and the server was unable to complete the request.

 

Last updated: Sep 13, 2024