Linc-Portal-Integration

Table of Contents

Purpose

Facilitates the integration between Linc’s mobile and web based Produce Portal, Vendor Portal and Customer Portal.

Implementation

Postman Collection

All the examples mentioned in this document can be found in this POSTMAN collection and can be used for testing (along with some other examples): Postman Collection Download

Authentication

Logging into the portal (whether from mobile or web) requires a portal user to provide the following information:

The portal host name, email and password will have been provided to the user by one of the portal tenants, since the email and password will have been registered in the portal tenant’s own Business Central database.

On submission of this login information, the portal app will first request tenant verification to obtain connection information from a static API url on Linc’s Business Central instance, then it will connect to the tenant’s Business Central instance to authenticate the user.

Two types of authentication needs to be supported: one for on-premise/self hosted tenants (basic authentication), one for saas/cloud hosted tenants (bearer token authentication)

Part of the tenant connection details response is a “tenantMenuStyle” attribute which determines the menu pages visible to the users of the tenant. This is only applicable for the Vendor portal. The options are:

Test Accounts

For details about test and production accounts with which to test/pass to app stores for verification, see Test Accounts

Tenant connection details

POST https://linc.linc.co.za:3048/bc365/ODataV4/portalApi_getTenantConnectionDetails

Request Body

{
    "payload": "{"portalType": "Vendor | Customer","portalHost": "<Portal Host>" e.g. SomeTenant}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"portalType\": \"Vendor\",\"portalHost\": \"TestTenant\"}"
}

Response Body

{
    "status": "badTenant | badPortalType | missingTenantBaseUrl | success",
    "tenantBaseUrl": "https://tenant.domain.co.za:port/instance/",
    "tenantUsername": "username",
    "tenantPassword": "webserviceaccesskey",
    "tenantMenuStyle": "Classic"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "{\"status\": \"success\",\"tenantBaseUrl\": \"https://bc.linc.co.za:6048/bc19dev/\",\"tenantUsername\": \"portal\",\"tenantPassword\": \"6WFiXslOWJUTCBvmFSgPgfItmf9VGFBtOILEgWPnlZM=\",\"tenantMenuStyle\": \"Classic\"}"
}

The response json is embeded in the “value” element and has to be have the double quote un-escaped.

User authentication details

POST {tenantBaseUrl}odatav4/portalApi_authenticateUser

Request Body

{
    "payload": "{"portalType": "Vendor","userEmail": "user@someplace.com","userPassword": "password", "actionType": "authenticate | verify"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"portalType\": \"Vendor\",\"userEmail\": \"attie@attieretief.com\",\"userPassword\": \"P@ssw0rd\",\"actionType\": \"authenticate\"}"
}

Response Body

{
    "status": "authenticated | badUser | badPassword | missingCompany | missingAccount | verified",
    "companyName": "CRONUS International Ltd.",
    "companyId": "69b48e0f-918b-ea11-9140-001dd8b71c89",
    "portalAccount": "V123456",
    "portalAccountName": "London Postmaster"    
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "{\"status\": \"authenticated\",\"companyName\": \"CRONUS International Ltd.\",\"companyId\": \"{3CCD69C3-1691-4A82-B914-A8A3409CAFE6}\",\"portalAccount\": \"10000\",\"portalAccountName\": \"London Postmaster\"}"
}

The response json is embeded in the “value” element and has to be have the double quote un-escaped.

Pagination

The pattern for paginating records (which is vital from a performance perspective) is to add $skip and $top query parameters to all the API/ODATA calls as follows:

given recordsPerPage = 10,
for page1, add "&$skip=0&$top=10" to the end of a request url (skip=(pageNumber-1) * recordsPerPage)
for page2, add "&$skip=10&$top=10" to the end of a request url (skip=(pageNumber-1) * recordsPerPage)
for page3, add "&$skip=20&$top=10" to the end of a request url  (skip=(pageNumber-1) * recordsPerPage)
etc.

Vendor Portal

Dashboard

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalVendors?$filter=number eq ‘{portalAccount}’

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalVendors?$filter=number eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalVendors",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O0pUZUg2MmhqM0Y3aHY0bVhXVE1MN3BSM1JzSDZDWUJwTTJvVXJsbjVXdEU9MTswMDsn\"",
            "systemId": "7a0613aa-a61b-4903-bc52-a53111a88718",
            "number": "10000",
            "name": "London Postmaster",
            "recordsFilterString": "buyFromVendorNumber eq '10000'",
            "filesFilterString": "tableID eq 23 and recordNumber eq '10000'",
            "balance": 114219.4,
            "upcomingOrders": 0,
            "deliveries": 0,
            "deliveriesPY": 0,
            "deliveriesYTD": 0,
            "invoices": 0,
            "invoicesPY": 0,
            "invoicesYTD": 0,
            "credits": 0,
            "creditsPY": 0,
            "creditsYTD": 0,
            "payments": 0,
            "paymentsPY": 0,
            "paymentsYTD": 0
        }
    ]
}

Produce Dashboard

In addition to the endpoint(s) called for the vendor dashboard,

Orders

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/vendorOrders?$filter={recordsFilterString}

For filtering orders, add the following to the filter query parameter at the end of the request url:

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/vendorOrders?$filter=buyFromVendorNumber eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/vendorOrders",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O2d5eGxtUHh2eUxkSEV4N0daV0p3Z29nUWw0ZHEvdStxRzk5NzdYeVdjbFk9MTswMDsn\"",
            "systemId": "ef6fefcc-1807-4840-a09c-21e5520e5954",
            "orderNumber": "106027",
            "referenceNumber": "",
            "deliverToName": "CRONUS International Ltd.",
            "orderDate": "2021-01-28",
            "deliveryDate": "0001-01-01",
            "completed": false,
            "buyFromVendorNumber": "10000",
            "buyFromVendorName": "London Postmaster",
            "amount": 99,
            "amountIncludingVAT": 108.9,
            "currencyCode": "",
            "tableId": 38
        }
    ]
}
Share an Order

To share an order, use the getReportBase64 method of portalApi and pass through the tableId of the order and the systemId of the order

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<vendorOrders.systemId>","tableId": "<vendorOrders.tableId>","portalType": "Vendor","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 38,\"portalType\": \"Vendor\", \"userEmail\": \"test@email.com\"}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Orders Details

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/vendorOrders(systemId)?expand=vendorOrderLines

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/vendorOrders(dc512104-8b65-4257-ba14-0ad57885725c)?$expand=vendorOrderLines

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/vendorOrders/$entity",
    "@odata.etag": "W/\"JzQ0O1FHeDk4d29qNkJqbjkzanRGaUZURVp6ZmlZMFdiYTdJVHRhMkxGMGFWVGs9MTswMDsn\"",
    "systemId": "dc512104-8b65-4257-ba14-0ad57885725c",
    "orderNumber": "6002",
    "referenceNumber": "",
    "deliverToName": "CRONUS International Ltd.",
    "orderDate": "2021-01-28",
    "deliveryDate": "0001-01-01",
    "completed": false,
    "buyFromVendorNumber": "45858585",
    "buyFromVendorName": "Busterby Stole og Borde A/S",
    "amount": 864571.97,
    "amountIncludingVAT": 864571.97,
    "currencyCode": "DKK",
    "tableId": 38,
    "vendorOrderLines": [
        {
            "@odata.etag": "W/\"JzQ0O2RMTHVKbGJDajhWVUlpbmxBWXB6UDl2ekRPaEI4dHFwUVJuQUN0S3VMUHc9MTswMDsn\"",
            "systemId": "a602cd9b-f64c-ec11-914b-00155d31b11c",
            "type": "Item",
            "number": "1964-S",
            "description": "TOKYO Gæstestol, blå",
            "unitOfMeasure": "PCS",
            "price": 834.76,
            "amount": 83476,
            "amountIncludingVAT": 83476,
            "quantity": 100,
            "quantityReceived": 0
        },
        {
            "@odata.etag": "W/\"JzQ0OytiWGg0a01taFdmTmtFSUlZd3BqVlNPdklkTE5LMyt5OGl0Rm1Ta09oaW89MTswMDsn\"",
            "systemId": "a702cd9b-f64c-ec11-914b-00155d31b11c",
            "type": "Item",
            "number": "1996-S",
            "description": "ATLANTA Whiteboard, basis",
            "unitOfMeasure": "PCS",
            "price": 6054.795,
            "amount": 666027.45,
            "amountIncludingVAT": 666027.45,
            "quantity": 110,
            "quantityReceived": 0
        },
        {
            "@odata.etag": "W/\"JzQ0O3R1dVpkaDNDS082SkdlaVkxZTZ3RFF2eXppdVQ0OS9wTElHbnVwZFdzbWM9MTswMDsn\"",
            "systemId": "a802cd9b-f64c-ec11-914b-00155d31b11c",
            "type": "Item",
            "number": "80100",
            "description": "Printerpapir",
            "unitOfMeasure": "PALLET",
            "price": 821.918,
            "amount": 115068.52,
            "amountIncludingVAT": 115068.52,
            "quantity": 140,
            "quantityReceived": 0
        }
    ]
}

Deliveries with Details

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/vendorDeliveries?$filter={recordsFilterString} \& $expand=vendorDeliveryLines

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/vendorDeliveries?$filter=buyFromVendorNumber eq '10000'&$expand=vendorDeliveryLines

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/vendorDeliveries",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O2ZDbm1zSUd2Uk1LTHF0cGtSQzI0ZU5DNXZyZFQ5b1NhTHc1YkxCa1RKWlU9MTswMDsn\"",
            "systemId": "83ffcc9b-f64c-ec11-914b-00155d31b11c",
            "deliveryNumber": "107018",
            "orderNumber": "106002",
            "referenceNumber": "",
            "vendorDeliveryNumber": "",
            "deliverToName": "CRONUS International Ltd.",
            "orderDate": "2021-01-06",
            "requestedDate": "0001-01-01",
            "receiptDate": "2021-01-06",
            "buyFromVendorNumber": "10000",
            "buyFromVendorName": "London Postmaster",
            "tableId": 120,
            "vendorDeliveryLines": [
                {
                    "@odata.etag": "W/\"JzQ0O25aL1Y4c0Zua2FvZkc2b0FkOWF1UGFSRmszZWh6U0xjdzN6cTZ5MU1JVkk9MTswMDsn\"",
                    "systemId": "caffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "1964-W",
                    "description": "INNSBRUCK Storage Unit/G.Door",
                    "unitOfMeasure": "PCS",
                    "quantity": 15,
                    "quantityOver": 0
                },
                {
                    "@odata.etag": "W/\"JzQ0O2RZWXdOT0xNVkd6a2dUSkl2U2psQVd5cjlvd2FOc2hDR0JsaEk2Z25XSnc9MTswMDsn\"",
                    "systemId": "cbffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "1964-W",
                    "description": "INNSBRUCK Storage Unit/G.Door",
                    "unitOfMeasure": "PCS",
                    "quantity": 25,
                    "quantityOver": 0
                }
            ]
        },
        {
            "@odata.etag": "W/\"JzQ0O1NsbzFML05TUys5NmZmSVVraXVYYVJpZXdoWjF5K1NWZVROTUl1YXRnZVU9MTswMDsn\"",
            "systemId": "84ffcc9b-f64c-ec11-914b-00155d31b11c",
            "deliveryNumber": "107019",
            "orderNumber": "106003",
            "referenceNumber": "",
            "vendorDeliveryNumber": "",
            "deliverToName": "CRONUS International Ltd.",
            "orderDate": "2021-01-09",
            "requestedDate": "0001-01-01",
            "receiptDate": "2021-01-09",
            "buyFromVendorNumber": "10000",
            "buyFromVendorName": "London Postmaster",
            "tableId": 120,
            "vendorDeliveryLines": [
                {
                    "@odata.etag": "W/\"JzQ0O00yU2dLSlkvZDZ2NXFCU3hXMU9tRmZxNHZITUxReWdYOE8vbUYrb3ZLNWM9MTswMDsn\"",
                    "systemId": "ccffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "70060",
                    "description": "Mounting",
                    "unitOfMeasure": "PCS",
                    "quantity": 250,
                    "quantityOver": 0
                },
                {
                    "@odata.etag": "W/\"JzQ0O2t0NDc4VWRweFArOWc2eEhJRnVTUnBqOStiVnpZWURZWHBHN0VWOVlXbVU9MTswMDsn\"",
                    "systemId": "cdffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "70060",
                    "description": "Mounting",
                    "unitOfMeasure": "PCS",
                    "quantity": 500,
                    "quantityOver": 0
                },
                {
                    "@odata.etag": "W/\"JzQ0O2lENThpRlNzRkRZVmJPKzdSTkhBaGlWVXN1QjNwaWlzdm5wd0Zob243NVk9MTswMDsn\"",
                    "systemId": "ceffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "70011",
                    "description": "Glass Door",
                    "unitOfMeasure": "PCS",
                    "quantity": 52,
                    "quantityOver": 0
                }
            ]
        },
        {
            "@odata.etag": "W/\"JzQ0O1lIRWVRUHpuenVpRG9WMTk4RmRlZklKRUdxS210ZVZXRlRxaytycUkrdEU9MTswMDsn\"",
            "systemId": "88ffcc9b-f64c-ec11-914b-00155d31b11c",
            "deliveryNumber": "107023",
            "orderNumber": "106006",
            "referenceNumber": "",
            "vendorDeliveryNumber": "",
            "deliverToName": "CRONUS International Ltd.",
            "orderDate": "2021-01-20",
            "requestedDate": "0001-01-01",
            "receiptDate": "2021-01-20",
            "buyFromVendorNumber": "10000",
            "buyFromVendorName": "London Postmaster",
            "tableId": 120,
            "vendorDeliveryLines": [
                {
                    "@odata.etag": "W/\"JzQ0O1hDZGVsYjhVL05LNm1QR3BJUldoLzlTd1V3Y3RORTFWMVBuVFdPNTBQcm89MTswMDsn\"",
                    "systemId": "cfffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "1924-W",
                    "description": "CHAMONIX Base Storage Unit",
                    "unitOfMeasure": "PCS",
                    "quantity": 5,
                    "quantityOver": 0
                },
                {
                    "@odata.etag": "W/\"JzQ0OzJNeFBhcTEyWldPYkUxSUJvbVVubkRkL1hwLzhFeXh3bWFsMEw2SlZyWVk9MTswMDsn\"",
                    "systemId": "d0ffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "1924-W",
                    "description": "CHAMONIX Base Storage Unit",
                    "unitOfMeasure": "PCS",
                    "quantity": 15,
                    "quantityOver": 0
                },
                {
                    "@odata.etag": "W/\"JzQ0O1cxUWx0SDk2anhvY29LT1FoNGlnakVjUk1LWkM0b3RhcHM1bFhZMlBRdUk9MTswMDsn\"",
                    "systemId": "d1ffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "1928-W",
                    "description": "ST.MORITZ Storage Unit/Drawers",
                    "unitOfMeasure": "PCS",
                    "quantity": 20,
                    "quantityOver": 0
                },
                {
                    "@odata.etag": "W/\"JzQ0OzVYVW0rSWllN2o5dUw2NUVXOHc3UXRqZk15VmdsVEdFVXZKRzhwbWM4MDQ9MTswMDsn\"",
                    "systemId": "d2ffcc9b-f64c-ec11-914b-00155d31b11c",
                    "type": "Item",
                    "number": "1928-W",
                    "description": "ST.MORITZ Storage Unit/Drawers",
                    "unitOfMeasure": "PCS",
                    "quantity": 41,
                    "quantityOver": 0
                }
            ]
        },
        {
            "@odata.etag": "W/\"JzQ0O0s1WjlGVkR1WUlVVGxyNDFlZnZqellkNFRJY2NDcHNGZTJnTHF0RjRlY1U9MTswMDsn\"",
            "systemId": "69f91a15-359a-ec11-916c-001dd8b71c89",
            "deliveryNumber": "107039",
            "orderNumber": "",
            "referenceNumber": "",
            "vendorDeliveryNumber": "",
            "deliverToName": "CRONUS International Ltd.",
            "orderDate": "2021-09-12",
            "requestedDate": "0001-01-01",
            "receiptDate": "2021-09-12",
            "buyFromVendorNumber": "10000",
            "buyFromVendorName": "London Postmaster",
            "tableId": 120,
            "vendorDeliveryLines": []
        }
    ]
}
Share a Delivery

To share an delivery, use the getReportBase64 method of portalApi and pass through the tableId of the delivery and the systemId of the delivery

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<vendorDeliveries.systemId>","tableId": "<vendorDeliveries.tableId>","portalType": "Vendor","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 120}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Transactions

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/vendorTransactions?$filter={recordsFilterString}

For filtering transactions, add the following to the filter query parameter at the end of the request url:

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/vendorTransactions?$filter=buyFromVendorNumber eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/vendorTransactions",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O3BsdGF5WGNjYU9oVFhOUmxHT29WTTY0d0RrWWd0djFEOXlqODYyWEdlUUU9MTswMDsn\"",
            "systemId": "df615dd8-f64c-ec11-914b-00155d31b11c",
            "documentType": "Payment",
            "documentNumber": "2593",
            "documentDate": "2021-01-13",
            "dueDate": "2021-01-13",
            "description": "Payment 2021",
            "referenceNumber": "",
            "amountIncludingVAT": 72240.56,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "buyFromVendorNumber": "10000",
            "vendorNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 25
        },
        {
            "@odata.etag": "W/\"JzQ0O0FWM0ljLytVVmtjOEw0ejZUTmZlMzBjekVlckdOMWl1N1IyRURYK2pOOGM9MTswMDsn\"",
            "systemId": "f4615dd8-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "5437",
            "documentDate": "2020-12-31",
            "dueDate": "2021-01-17",
            "description": "Opening Entries, Vendors",
            "referenceNumber": "5437",
            "amountIncludingVAT": -72240.56,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "buyFromVendorNumber": "10000",
            "vendorNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 25
        },
    ]
}
Download a list of transactions

To download all vendor’s transactions as an excel file, use the getReportBase64 method of portalApi as described above, but include the optional asExcel boolean attribute in the request payload

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<portalVendor.systemId>","tableId": "<portalVendor.tableId>"[, "asExcel: true],"portalType": "Vendor","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 23,\"asExcel\": true,\"portalType\": \"Vendor\",\"userEmail\": \"producelinc\"}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting Excel file>"
}
Share a Transaction

To share an transaction, use the getReportBase64 method of portalApi and pass through the tableId of the transaction and the systemId of the transaction

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<vendorTransactions.systemId>","tableId": "<vendorTransactions.tableId>","portalType": "Vendor","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 25}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}
Share a Transaction Excel Sheet

Some vendor transactions may have an excel sheet available for download. This is indicated by the sheetAvailable attribute of the vendorTransaction entity. To share a transaction’s excel sheet, use the getReportBase64 method of portalApi as described above, but include the optional asExcel boolean attribute in the request payload

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<customerTransactions.systemId>","tableId": "<customerTransactions.tableId>"[, "asExcel: true],"portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 21,\"asExcel\": true}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting Excel file>"
}
Show Transaction Files

To show files/attachments linked to a transaction, use the portalFiles entity and add the “filesFilterString” attribute of the transaction as a filter query parameter to the end of the url

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalFiles?$filter={vendorTransactions.fileSilterString}

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalFiles?$filter=tableID eq 122 and recordNumber eq '108037'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalFiles",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O1ZDdWxQbVV5aFY2N1dSY0VlSUYwR0RPVHhNRituTEQzQWZDWjhRcDdSR3M9MTswMDsn\"",
            "systemId": "73f91a15-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:28:53.357Z",
            "fileType": "PDF",
            "fileName": "Amendments to quarantine and isolation regulations_WC_MD",
            "fileExtension": "pdf",
            "portalLabel": "CONTRACTS",
            "tableID": 122,
            "recordNumber": "108037",
            "attachmentID": 22
        },
        {
            "@odata.etag": "W/\"JzQ0O280cTJORkY2MjRkdFpmS1pyU05nUDBjQVVSMytmUTNJN0orMm0yYjhtL2s9MTswMDsn\"",
            "systemId": "225d452b-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:29:30.187Z",
            "fileType": "Image",
            "fileName": "4985260",
            "fileExtension": "jpg",
            "portalLabel": "QUALITY",
            "tableID": 122,
            "recordNumber": "108037",
            "attachmentID": 23
        }
    ]
}
Share a Transaction Attachment/File

To share a transaction attachment/file, use the getAttachmentBase64 method of portalApi and pass through the attachmentId of the transaction file

POST {tenantBaseUrl}ODataV4/portalApi_getAttachmentBase64

Request Body

{
    "payload": "{"attachmentId": "<portalFiles.attachmentId>","portalType": "Vendor","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"attachmentId\": 23}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Show Vendor Files

To show files/attachments linked to a vendor, use the portalFiles entity and add the “filesFilterString” attribute of the vendor as a filter query parameter to the end of the url

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalFiles?$filter={portalVendors.fileSilterString}

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalFiles?$filter=tableID eq 23 and recordNumber eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalFiles",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O1ZDdWxQbVV5aFY2N1dSY0VlSUYwR0RPVHhNRituTEQzQWZDWjhRcDdSR3M9MTswMDsn\"",
            "systemId": "73f91a15-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:28:53.357Z",
            "fileType": "PDF",
            "fileName": "Amendments to quarantine and isolation regulations_WC_MD",
            "fileExtension": "pdf",
            "portalLabel": "CONTRACTS",
            "tableID": 23,
            "recordNumber": "10000",
            "attachmentID": 22
        },
        {
            "@odata.etag": "W/\"JzQ0O280cTJORkY2MjRkdFpmS1pyU05nUDBjQVVSMytmUTNJN0orMm0yYjhtL2s9MTswMDsn\"",
            "systemId": "225d452b-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:29:30.187Z",
            "fileType": "Image",
            "fileName": "4985260",
            "fileExtension": "jpg",
            "portalLabel": "QUALITY",
            "tableID": 23,
            "recordNumber": "10000",
            "attachmentID": 23
        }
    ]
}
Get unique list of portal file labels used for the vendor

To get the unique list of portal file labels for a given vendor

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalFileLabels?$filter={portalVendors.fileSilterString}

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalFileLabels?$filter=tableID eq 23 and recordNumber eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalFileLabels",
    "value": [
        {
            "tableID": 23,
            "recordNumber": "10000",
            "portalLabel": "Contracts",
            "numberOfFiles": 1
        },
        {
            "tableID": 23,
            "recordNumber": "10000",
            "portalLabel": "General",
            "numberOfFiles": 1
        },
        {
            "tableID": 23,
            "recordNumber": "10000",
            "portalLabel": "Quality",
            "numberOfFiles": 2
        }
    ]
}
Share a Vendor Attachment/File

To share a vendor attachment/file, use the getAttachmentBase64 method of portalApi and pass through the attachmentId of the transaction file

POST {tenantBaseUrl}ODataV4/portalApi_getAttachmentBase64

Request Body

{
    "payload": "{"attachmentId": "<portalFiles.attachmentId>","portalType": "Vendor","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"attachmentId\": 23}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Quality Summaries

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalQualitySummaries?$filter={recordsFilterString}

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalQualitySummaries?$filter=payToVendorNumber eq 'PVEN014'

Example Response Body:

{
  "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(df3a1822-a782-47a9-87b1-f5cb70506d3f)/portalQualitySummaries",
  "value": [
    {
      "payToVendorNumber": "PVEN014",
      "producerCode": "H2736",
      "commodityCode": "NC",
      "varietyCode": "UNC",
      "sizeCode": "L",
      "qualityCode": "AMBER",
      "qualityRemark": "THIS",
      "lastQualityDocumentNumber": "TRD0360 QC",
      "quantity": 280,
      "qualityDocumentSystemId": "fe5076ef-f64c-ec11-914b-00155d31b11c",
      "sourceContainerNumber": "",
      "actualDepartureYearWeek": "202118"
    },
    {
      "payToVendorNumber": "PVEN014",
      "producerCode": "H2736",
      "commodityCode": "NC",
      "varietyCode": "UNC",
      "sizeCode": "L",
      "qualityCode": "GREEN",
      "qualityRemark": "TEST",
      "lastQualityDocumentNumber": "TRD0360 QC",
      "quantity": 280,
      "qualityDocumentSystemId": "fe5076ef-f64c-ec11-914b-00155d31b11c",
      "sourceContainerNumber": "",
      "actualDepartureYearWeek": "202118"
    },
    {
      "payToVendorNumber": "PVEN014",
      "producerCode": "H2736",
      "commodityCode": "NC",
      "varietyCode": "UNC",
      "sizeCode": "L",
      "qualityCode": "RED",
      "qualityRemark": "STUFF",
      "lastQualityDocumentNumber": "TRD0360 QC",
      "quantity": 280,
      "qualityDocumentSystemId": "fe5076ef-f64c-ec11-914b-00155d31b11c",
      "sourceContainerNumber": "",
      "actualDepartureYearWeek": "202118"
    }
  ]
}

Quality Document (Detail)

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalQualityDocuments(qualityDocumentSystemId)?$expand=qualityDocumentLines($filter={recordsFilterString})

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalQualityDocuments(fe5076ef-f64c-ec11-914b-00155d31b11c)?$expand=qualityDocumentLines(buyFromVendorNumber eq '10000')

Example Response Body:

{
  "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(df3a1822-a782-47a9-87b1-f5cb70506d3f)/portalQualityDocuments/$entity",
  "@odata.etag": "W/\"JzQ0O21CNy9PbFc1V0U0UmxLdHJPRWEvNndiQy82NkhNYWVTZHpiK3JWeTErQjQ9MTswMDsn\"",
  "systemId": "fe5076ef-f64c-ec11-914b-00155d31b11c",
  "documentNumber": "TRD0360 QC",
  "documentDate": "2022-09-15",
  "documentType": "ARRIVAL QC",
  "externalDocumentNumber": "ABC123546",
  "sourceProduceTradeNumber": "TRD0360",
  "sourceContainerNumber": "",
  "documentComments": "This is me opinion, please consider it:\n\n1. Stop farming\n2. Sell your farm\n3. Get an education\n\nFor more tips and tricks from me, including sarcasm, follow me on instagram.\n\nTill next time\nAttie",
  "tableId": 85031,
  "filesFilterString": "tableID eq 85031 and recordNumber eq 'TRD0360 QC'",
  "qualityDocumentLines": [
    {
      "@odata.etag": "W/\"JzQ0O1ZnbXBBV2tyak1ZYmdwRUtKV0RyNXFvSmpIbjRvRVVtV1ZBczJCNGdzbEU9MTswMDsn\"",
      "systemId": "d42537eb-f64c-ec11-914b-00155d31b11c",
      "producerCode": "H2736",
      "producerName": "KONSTABEL",
      "producerLotNumber": "",
      "producerSiteCode": "",
      "palletId": "2021AX55900014",
      "commodityCode": "NC",
      "commodityDescription": "NECTARCOT",
      "varietyCode": "UNC",
      "varietyDescription": "UNC",
      "sizeCode": "L",
      "sizeDescription": "LARGE",
      "qualityCode": "GREEN",
      "qualityRemark": "TEST",
      "quantity": 280
    },
    {
      "@odata.etag": "W/\"JzQ0O0RyWVBabmk3RUl5bHhjYmdaZldQbXY3ZmRvbG9LUVJiV1AzUGlmclhXS1k9MTswMDsn\"",
      "systemId": "d52537eb-f64c-ec11-914b-00155d31b11c",
      "producerCode": "H2736",
      "producerName": "KONSTABEL",
      "producerLotNumber": "",
      "producerSiteCode": "",
      "palletId": "2021AX55900015",
      "commodityCode": "NC",
      "commodityDescription": "NECTARCOT",
      "varietyCode": "UNC",
      "varietyDescription": "UNC",
      "sizeCode": "L",
      "sizeDescription": "LARGE",
      "qualityCode": "AMBER",
      "qualityRemark": "THIS",
      "quantity": 280
    }
  ]
}

Customer Portal

Dashboard

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalCustomers?$filter=number eq ‘{portalAccount}’

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalCustomers?$filter=number eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalCustomers",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O1Uxa0hVL0JMeFVqelFuL29aQitRY0lEQTR4OHV6eEZHVUk0c1NhdFQvQ0k9MTswMDsn\"",
            "systemId": "a042a37c-ab38-4454-8279-dfbc1ed69ffc",
            "number": "10000",
            "name": "The Cannon Group PLC",
            "recordsFilterString": "sellToCustomerNumber eq '10000'",
            "filesFilterString": "tableID eq 18 and recordNumber eq '10000'",
            "balance": 168551.91,
            "upcomingOrders": 0,
            "shipments": 0,
            "shipmentsPY": 0,
            "shipmentsYTD": 0,
            "invoices": 0,
            "invoicesPY": 0,
            "invoicesYTD": 0,
            "credits": 0,
            "creditsPY": 0,
            "creditsYTD": 0,
            "payments": 0,
            "paymentsPY": 0,
            "paymentsYTD": 0
        }
    ]
}

Orders

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/customerOrders?$filter={recordsFilterString}

For filtering orders, add the following to the filter query parameter at the end of the request url:

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/customerOrders?$filter=sellToCustomerNumber eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/customerOrders",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O0diR0hhanVGeTRaK1VzM1p2VmFBU1NCRnlEbmNkSXZFU2lzaEEwYklTTk09MTswMDsn\"",
            "systemId": "09f62ea5-8c65-4adc-94e7-1a6e24f04c8b",
            "orderNumber": "104001",
            "referenceNumber": "",
            "shipToName": "The Cannon Group PLC",
            "orderDate": "2021-01-20",
            "shipmentDate": "2021-01-20",
            "completed": false,
            "sellToCustomerNumber": "10000",
            "sellToCustomerName": "The Cannon Group PLC",
            "amount": 0,
            "amountIncludingVAT": 0,
            "currencyCode": "",
            "tableId": 36
        }
    ]
}
Share an Order

To share an order, use the getReportBase64 method of portalApi and pass through the tableId of the order and the systemId of the order

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<customerOrders.systemId>","tableId": "<customerOrders.tableId>","portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 18}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Orders Details

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/customerOrders(systemId)?expand=customerOrderLines

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/customerOrders(dc512104-8b65-4257-ba14-0ad57885725c)?$expand=customerOrderLines

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/customerOrders/$entity",
    "@odata.etag": "W/\"JzQ0O3R4dWZ0Nm93ZjAzdk5OU3pRZFVoRTdsU1JWUm8rOThIUGlvSEZHRkdNMms9MTswMDsn\"",
    "systemId": "8dc1a16c-394a-4a93-9e7d-6e2d880cda55",
    "orderNumber": "1014",
    "referenceNumber": "",
    "shipToName": "The Cannon Group PLC",
    "orderDate": "2021-09-12",
    "shipmentDate": "2021-09-12",
    "completed": false,
    "sellToCustomerNumber": "10000",
    "sellToCustomerName": "The Cannon Group PLC",
    "amount": 100,
    "amountIncludingVAT": 125,
    "currencyCode": "",
    "tableId": 36,
    "customerOrderLines": [
        {
            "@odata.etag": "W/\"JzQ0Ozd4SHpZdzlMaXBsbkpORjdWckNpa0RVaUJ3MkpmZzJiK3ZBZ05qNnBDTWM9MTswMDsn\"",
            "systemId": "bbb9ecad-f64c-ec11-914b-00155d31b11c",
            "type": "Item",
            "number": "1980-S",
            "description": "MOSCOW Swivel Chair, red",
            "unitOfMeasure": "PCS",
            "price": 50,
            "amount": 50,
            "amountIncludingVAT": 62.5,
            "quantity": 1,
            "quantityShipped": 1
        },
        {
            "@odata.etag": "W/\"JzQ0O0lXOTZwWTE0c0dpc2pBK01ubTRBalZuSDF0OVZ5U0c4MGJjR3R6ci9SZEE9MTswMDsn\"",
            "systemId": "bdb9ecad-f64c-ec11-914b-00155d31b11c",
            "type": "Item",
            "number": "1980-S",
            "description": "MOSCOW Swivel Chair, red",
            "unitOfMeasure": "PCS",
            "price": 50,
            "amount": 50,
            "amountIncludingVAT": 62.5,
            "quantity": 1,
            "quantityShipped": 0
        }
    ]
}

Shipments with Details

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/customerShipments?$filter={recordsFilterString} \& $expand=customerShipmentLines

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/customerShipments?$filter=sellToCustomerNumber eq '10000'&$expand=customerShipmentLines

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/customerShipments/$entity",
    "@odata.etag": "W/\"JzQ0O1JlaXlUdElhc1dubGpzYW03K3R0YTFVQmVIdm82S25EeUs3dnJCaWFCQ2M9MTswMDsn\"",
    "systemId": "f2ae1bb4-f64c-ec11-914b-00155d31b11c",
    "shipmentNumber": "102001",
    "orderNumber": "101001",
    "referenceNumber": "",
    "customerShipmentNumber": "",
    "shipToName": "The Cannon Group PLC",
    "orderDate": "2021-01-07",
    "requestedDate": "0001-01-01",
    "shipmentDate": "2021-01-07",
    "sellToCustomerNumber": "10000",
    "sellToCustomerName": "The Cannon Group PLC",
    "tableId": 110,
    "customerShipmentLines": [
        {
            "@odata.etag": "W/\"JzQ0O2lVQmRyN1pBazhKVUhOSjJ1OURMSWovN0dlc2tZSk95d3BtUGNoRG9HVkU9MTswMDsn\"",
            "systemId": "55af1bb4-f64c-ec11-914b-00155d31b11c",
            "type": "Item",
            "number": "1968-S",
            "description": "MEXICO Swivel Chair, black",
            "unitOfMeasure": "PCS",
            "quantity": 2
        },
        {
            "@odata.etag": "W/\"JzQ0O1NySjhqdHNrNTBrNUViWDlLYTlXTllIVEVwbllaUE9taVd3MThySFhYMEE9MTswMDsn\"",
            "systemId": "56af1bb4-f64c-ec11-914b-00155d31b11c",
            "type": "Item",
            "number": "1996-S",
            "description": "ATLANTA Whiteboard, base",
            "unitOfMeasure": "PCS",
            "quantity": 3
        }
    ]
}
Share a Shipment

To share an shipment, use the getReportBase64 method of portalApi and pass through the tableId of the shipment and the systemId of the shipment

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<customerShipments.systemId>","tableId": "<customerShipments.tableId>","portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 110}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Transactions

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/customerTransactions?$filter={recordsFilterString}

For filtering transactions, add the following to the filter query parameter at the end of the request url:

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/customerTransactions?$filter=sellToCustomerNumber eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/customerTransactions",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0OzVId3pyQWdGYUM2bForeCtzWTlySTUzQU1Cak1kTTh0enh0Y0wwQUtJa3c9MTswMDsn\"",
            "systemId": "f6299125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Payment",
            "documentNumber": "2596",
            "documentDate": "2021-01-17",
            "dueDate": "2021-01-17",
            "description": "Payment 2021",
            "referenceNumber": "",
            "amountIncludingVAT": -25389.25,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O0taTWx3dTl3ZW5uTFI4VFZWWE9Xd2grSEk5dVczT0FTTWVSeTUrZkZPRWs9MTswMDsn\"",
            "systemId": "f7299125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Payment",
            "documentNumber": "2596",
            "documentDate": "2021-01-17",
            "dueDate": "2021-01-17",
            "description": "Payment 2021",
            "referenceNumber": "",
            "amountIncludingVAT": -50778.5,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O00rUzdnZUxZcjFLVXkvbFRoMmRTQUxGeHhZSkV6OGJ1Vng2MGgrTG1teU09MTswMDsn\"",
            "systemId": "f8299125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Payment",
            "documentNumber": "2596",
            "documentDate": "2021-01-17",
            "dueDate": "2021-01-17",
            "description": "Payment 2021",
            "referenceNumber": "",
            "amountIncludingVAT": -67704.67,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O2ExYXFCaHp4UXRlc2V3ZzlRVzZVWG5BYm5JS3ZUQWdWbGloMkxjOWJPMjQ9MTswMDsn\"",
            "systemId": "fd299125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "00-1",
            "documentDate": "2020-12-31",
            "dueDate": "2021-01-01",
            "description": "Opening Entries, Customers",
            "referenceNumber": "",
            "amountIncludingVAT": 25389.25,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O0xKY3ZOdGliWFJzRlRqaW5UMEZMd2ZWUjAzU3VmZFQ2NDQ5cUkySm9JN1E9MTswMDsn\"",
            "systemId": "fe299125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "00-3",
            "documentDate": "2020-12-31",
            "dueDate": "2021-01-07",
            "description": "Opening Entries, Customers",
            "referenceNumber": "",
            "amountIncludingVAT": 50778.5,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O3EzNUFxT2JWZ2szZGZQbWk0RnN4eTR3Wm1LdFo1T0NoeWh6dkx1RllCNnM9MTswMDsn\"",
            "systemId": "ff299125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "00-6",
            "documentDate": "2020-12-31",
            "dueDate": "2021-01-11",
            "description": "Opening Entries, Customers",
            "referenceNumber": "",
            "amountIncludingVAT": 67704.67,
            "balanceIncludingVAT": 0,
            "currencyCode": "",
            "open": false,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O1NxWWkyeUUzbUMvVTdKbDNYWDJrbFlPNjdpWERPZDNuV0dSUVo4dGV3NnM9MTswMDsn\"",
            "systemId": "042a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "00-11",
            "documentDate": "2020-12-31",
            "dueDate": "2021-01-31",
            "description": "Opening Entries, Customers",
            "referenceNumber": "",
            "amountIncludingVAT": 63473.13,
            "balanceIncludingVAT": 63473.13,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0Oy92cHE4RW1ndEJHdUEwaXltZGVObHUrd1ZMeFk1NnlFWEJ6TWpEa3FRNFk9MTswMDsn\"",
            "systemId": "082a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "00-16",
            "documentDate": "2020-12-31",
            "dueDate": "2021-01-31",
            "description": "Opening Entries, Customers",
            "referenceNumber": "",
            "amountIncludingVAT": 33852.35,
            "balanceIncludingVAT": 33852.35,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0OysvL25pZ3lhU0hGeXJHbTNzMHYxWXAxYlJzNXgxTkUyYzIwVmg4NkVoRE09MTswMDsn\"",
            "systemId": "0d2a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "00-9",
            "documentDate": "2020-12-31",
            "dueDate": "2021-01-31",
            "description": "Opening Entries, Customers",
            "referenceNumber": "",
            "amountIncludingVAT": 50778.5,
            "balanceIncludingVAT": 50778.5,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O2RkRDFlbGRwVXpSLzR6RkxyVjYrbERob3VRNlFnMHZSOU9QdFFIRElsWlU9MTswMDsn\"",
            "systemId": "1a2a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "103015",
            "documentDate": "2021-01-07",
            "dueDate": "2021-02-07",
            "description": "Order 101001",
            "referenceNumber": "",
            "amountIncludingVAT": 8269.04,
            "balanceIncludingVAT": 8269.04,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O3BKOFBydXp3L0lPeTR0MHlHYlU5bzcwYlJyMEZpRnJRd0NvUm1jQytKcnM9MTswMDsn\"",
            "systemId": "222a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "103028",
            "documentDate": "2021-01-20",
            "dueDate": "2021-02-20",
            "description": "Order 6005",
            "referenceNumber": "",
            "amountIncludingVAT": 4101.88,
            "balanceIncludingVAT": 4101.88,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O2lBdTgxcnlzaEd3WGNkY2tnWWRSODBnb2M1QWZQOXYwbFNyOTM1aEFMUFk9MTswMDsn\"",
            "systemId": "272a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "103001",
            "documentDate": "2021-01-25",
            "dueDate": "2021-02-25",
            "description": "Invoice 103001",
            "referenceNumber": "",
            "amountIncludingVAT": 8182.35,
            "balanceIncludingVAT": 8182.35,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O3J3YkJoTFRUT00rY0QrNE9UbEZhRDIxWENPZXpLOFVJaXZNK3ZzelNTWjA9MTswMDsn\"",
            "systemId": "302a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "103033",
            "documentDate": "2021-09-12",
            "dueDate": "2021-10-12",
            "description": "Order 1012",
            "referenceNumber": "",
            "amountIncludingVAT": 125,
            "balanceIncludingVAT": 125,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O1pXZW5yODFmVEI1V2RGUDFDOFJOYW9LUGMxKzNhMW92NHFFSzdtRHljWUk9MTswMDsn\"",
            "systemId": "312a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Invoice",
            "documentNumber": "103034",
            "documentDate": "2021-09-12",
            "dueDate": "2021-10-12",
            "description": "Order 1014",
            "referenceNumber": "",
            "amountIncludingVAT": 62.5,
            "balanceIncludingVAT": 62.5,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        },
        {
            "@odata.etag": "W/\"JzQ0O2FZaG40T3Zrck90NGtMb0pKR0NtTEZPem0wSTU0bWgxSWVTUElIRWFzMlk9MTswMDsn\"",
            "systemId": "392a9125-f64c-ec11-914b-00155d31b11c",
            "documentType": "Credit Memo",
            "documentNumber": "104001",
            "documentDate": "2021-01-17",
            "dueDate": "2021-01-17",
            "description": "Credit Memo 104001",
            "referenceNumber": "",
            "amountIncludingVAT": -292.84,
            "balanceIncludingVAT": -292.84,
            "currencyCode": "",
            "open": true,
            "sellToCustomerNumber": "10000",
            "customerNumber": "10000",
            "hasFiles": false,
            "filesFilterString": "",
            "tableId": 21
        }
    ]
}
Download a list of transactions

To download all customer’s transactions as an excel file, use the getReportBase64 method of portalApi as described above, but include the optional asExcel boolean attribute in the request payload

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<portalVendor.systemId>","tableId": "<portalCustomer.tableId>"[, "asExcel: true],"portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 18,\"asExcel\": true,\"portalType\": \"Customer\",\"userEmail\": \"producelinc\"}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting Excel file>"
}
Share a Transaction

To share an transaction, use the getReportBase64 method of portalApi and pass through the tableId of the transaction and the systemId of the transaction

POST {tenantBaseUrl}ODataV4/portalApi_getReportBase64

Request Body

{
    "payload": "{"systemId": "<customerTransactions.systemId>","tableId": "<customerTransactions.tableId>","portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"systemId\": \"fd615dd8-f64c-ec11-914b-00155d31b11c\",\"tableId\": 21}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}
Show Transaction Files

To show files/attachments linked to a transaction, use the portalFiles entity and add the “filesFilterString” attribute of the transaction as a filter query parameter to the end of the url

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalFiles?$filter={customerTransactions.fileSilterString}

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalFiles?$filter=tableID eq 122 and recordNumber eq '108037'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalFiles",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O1ZDdWxQbVV5aFY2N1dSY0VlSUYwR0RPVHhNRituTEQzQWZDWjhRcDdSR3M9MTswMDsn\"",
            "systemId": "73f91a15-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:28:53.357Z",
            "fileType": "PDF",
            "fileName": "Amendments to quarantine and isolation regulations_WC_MD",
            "fileExtension": "pdf",
            "portalLabel": "CONTRACTS",
            "tableID": 122,
            "recordNumber": "108037",
            "attachmentID": 22
        },
        {
            "@odata.etag": "W/\"JzQ0O280cTJORkY2MjRkdFpmS1pyU05nUDBjQVVSMytmUTNJN0orMm0yYjhtL2s9MTswMDsn\"",
            "systemId": "225d452b-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:29:30.187Z",
            "fileType": "Image",
            "fileName": "4985260",
            "fileExtension": "jpg",
            "portalLabel": "QUALITY",
            "tableID": 122,
            "recordNumber": "108037",
            "attachmentID": 23
        }
    ]
}
Share a Transaction Attachment/File

To share a transaction attachment/file, use the getAttachmentBase64 method of portalApi and pass through the attachmentId of the transaction file

POST {tenantBaseUrl}ODataV4/portalApi_getAttachmentBase64

Request Body

{
    "payload": "{"attachmentId": "<portalFiles.attachmentId>","portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"attachmentId\": 23}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Show Customer Files

To show files/attachments linked to a customer, use the portalFiles entity and add the “filesFilterString” attribute of the customer as a filter query parameter to the end of the url

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalFiles?$filter={portalCustomers.fileSilterString}

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3CCD69C3-1691-4A82-B914-A8A3409CAFE6)/portalFiles?$filter=tableID eq 18 and recordNumber eq '10000'

Example Response Body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalFiles",
    "value": [
        {
            "@odata.etag": "W/\"JzQ0O1ZDdWxQbVV5aFY2N1dSY0VlSUYwR0RPVHhNRituTEQzQWZDWjhRcDdSR3M9MTswMDsn\"",
            "systemId": "73f91a15-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:28:53.357Z",
            "fileType": "PDF",
            "fileName": "Amendments to quarantine and isolation regulations_WC_MD",
            "fileExtension": "pdf",
            "portalLabel": "CONTRACTS",
            "tableID": 23,
            "recordNumber": "10000",
            "attachmentID": 22
        },
        {
            "@odata.etag": "W/\"JzQ0O280cTJORkY2MjRkdFpmS1pyU05nUDBjQVVSMytmUTNJN0orMm0yYjhtL2s9MTswMDsn\"",
            "systemId": "225d452b-359a-ec11-916c-001dd8b71c89",
            "attachedDate": "2022-03-02T14:29:30.187Z",
            "fileType": "Image",
            "fileName": "4985260",
            "fileExtension": "jpg",
            "portalLabel": "QUALITY",
            "tableID": 23,
            "recordNumber": "10000",
            "attachmentID": 23
        }
    ]
}
Share a Customer Attachment/File

To share a customer attachment/file, use the getAttachmentBase64 method of portalApi and pass through the attachmentId of the transaction file

POST {tenantBaseUrl}ODataV4/portalApi_getAttachmentBase64

Request Body

{
    "payload": "{"attachmentId": "<portalFiles.attachmentId>","portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"attachmentId\": 23}"
}

Here is an example response body:

{
    "@odata.context": "https://bc.linc.co.za:6048/bc19dev/ODataV4/$metadata#Edm.String",
    "value": "<this will contain a base64 string of the resulting PDF>"
}

Generate a customer statement

To generate a statement for a customer, a few web service calls are required. A sample layout is available on request.

The main sections of the statement are:

Two versions of the statement need to be supported:

Company details

To display the tenant/company information, access the portalStatementInfo entity

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/portalStatementInfo

Here is an example response body:

{
  "@odata.context": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/$metadata#companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalStatementInfo",
  "value": [
    {
      "@odata.etag": "W/\"JzQ0O0IxTDdTY0JqS1NXczZPclJOcVQ4Ni8xR1ZGN0doWUp4WUNqRmI1citMK3M9MTswMDsn\"",
      "systemId": "a3118955-d805-4774-b62c-2c5550a253b8",
      "displayName": "CRONUS International Ltd.",
      "address": "{\r\n  \"street\": \"5 The Ring\\r\\nWestminster\",\r\n  \"city\": \"London\",\r\n  \"state\": \"\",\r\n  \"countryLetterCode\": \"GB\",\r\n  \"postalCode\": \"W2 8HG\"\r\n}",
      "phoneNumber": "0666-666-6666",
      "faxNumber": "0666-666-6660",
      "email": "accounts@cronus.co.uk",
      "website": "www.cronus.co.uk",
      "taxRegistrationNumber": "777777777",
      "currencyCode": "GBP",
      "currentFiscalYearStartDate": "2022-01-01",
      "industry": "",
      "picture@odata.mediaReadLink": "https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/portalStatementInfo(a3118955-d805-4774-b62c-2c5550a253b8)/picture",
      "businessProfileId": "",
      "lastModifiedDateTime": "2020-03-30T19:14:52.5Z"
    }
  ]
}

To display the tenant/company logo, access the picture attribute from the portalStatementInfo response above and use the returned picture mediareadlink in a web service call

GET {picture@odata.mediaReadLink}

The response is the binary picture data

Customer details

To display the customer details, simply use the response of the portalCustomers call used for the customer dashboard

Statement date, opening balance and closing balance (total)

From the response of the following portalApi_getStatementBalances web service call, you will obtain

POST {tenantBaseUrl}/odatav4/portalApi_getStatementBalances?company=’{portalApi_authenticateUser.companyName}’

Request Body

{
    "payload": "{"statementType": open | lastMonth, customerNumber: <accountNumber>, "portalType": "Customer","userEmail": "user@someplace.com"}"
}

The payload attribute has to have double quotes escaped - this is a platform restriction. Here is an example for testing:

{
    "payload": "{\"statementType\": \"{open or lastMonth}\",\"customerNumber\": \"10000\"}"
}

Here is an example response body:

{
  "@odata.context": "https://bc.linc.co.za:6048/bc19dev/odatav4/$metadata#Edm.String",
  "value": "{\"status\": \"success\",\"openingBalance\": \"168,551.91\",\"closingBalance\": \"168,551.91\", \"statementDate\": \"2022-04-30\", \"startDate\": \"2022-04-01\"}"
}
Statement entries

For statement entries, use the customerTransactions web service as before, but with 2 options for filtering, and explicitly order by date…

GET {tenantBaseUrl}api/linc/portal/v2.0/companies(companyId)/customerTransactions?$filter={recordsFilterString}&$orderby=documentDate

For filtering transactions, add the following to the filter query parameter at the end of the request url:

On both versions, print the Currency on total using the currency code from the dashboard entity (portalCustomers)

Example Request:

https://bc.linc.co.za:6048/bc19dev/api/linc/portal/v2.0/companies(3ccd69c3-1691-4a82-b914-a8a3409cafe6)/customerTransactions?$filter=sellToCustomerNumber eq '10000' and documentDate ge 2021-01-01 and documentDate le 2021-01-31&$orderby=documentDate