Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

Overview

This document details the specification of the myBuildings API import of Creditor invoices. Based on the data returned from the API Call new Creditor Invoices and GL Journals will be created in Synergetic Database and Postings will be shown under Creditor Invoice Entry in Synergetic.

...

Field for Creditor Invoice Details

Field Name

SQL Data Type

Mandatory

Description

ContractorName

VARCHAR (100)

N

Creditor PayeeName

ThirdPartySystem_ContractorID

INTEGER

Y

Synergetic Creditor ID

InvoiceAmount

MONEY

Y

Invoice Amount (Excl. Tax)

InvoiceTax

MONEY

Y

Invoice Tax Amount

InvoiceDate

DATETIME

Y

Invoice Date

InvoiceNumber

VARCHAR (15)

Y

Invoice Number

InvoiceDescription

VARCHAR (100)

Y

Description for this Invoice

Fields for GLAllocations

Field Name

SQL Data Type

Mandatory

Description

AccountNumber

VARCHAR (15)

Y

GLCode. Must exist in Synergetic General Ledger

Amount

MONEY

Y

GLAmount (Excl. Tax)

TaxCode

VARCHAR (5)

N

Tax Code must exist in luTax

GLDescription

VARCHAR (50)

N

Invoice Description from the Invoices Node.

TaxAmount

MONEY

Y

The amount of tax for the allocation.

Sample SQL Code for API Call to myBuildings:   

Code Block
languagesql
    DECLARE @authHeader VARCHAR(8000);

    DECLARE @contentType VARCHAR(8000);

    DECLARE @postData VARCHAR(8000);

    DECLARE @responseText VARCHAR(8000);

    DECLARE @responseXML VARCHAR(8000);

    DECLARE @ret INT;

    DECLARE @status VARCHAR(8000);

    DECLARE @statusText VARCHAR(8000);

    DECLARE @token INT;

    DECLARE @url VARCHAR(8000);

    DECLARE @JSON VARCHAR(MAX);

 

    SET @authHeader = 'Bearer ?????????????????';

    SET @contentType = 'application/json';

    SET @url = 'https://sb-pk.mybuildings-stage.com/core/api/invoices/v1?statusid=17 '

 

    -- Open the connection.

    EXEC @ret = sp_OACreate 'MSXML2.ServerXMLHTTP', @token OUT;

    IF @ret <> 0 RAISERROR('Unable to open HTTP connection.', 10, 1);

 

 

    -- Send the request.

 

    EXEC @ret = sp_OAMethod @token, 'Open', null, 'GET', @Url, 'false'

    EXEC @ret = sp_OAMethod @token, 'setRequestHeader', NULL, 'Authorization', @authHeader;

    EXEC @ret = sp_OAMethod @token, 'setRequestHeader', NULL, 'Content-type', @contentType;

 

    EXEC sp_OAMethod @token, 'send', null

    EXEC sp_OAMethod @token, 'responseText', @ResponseText OUTPUT

 

    SET @JSON = REPLACE(@ResponseText,'{"Success":true,"Data":','')

...

Process will only import Creditor Invoices with Status “17: Approved for Processing“

workrequest API (POST)

Field Name

SQL Data Type

Mandatory

Description

NewStatusID

Integer

 

 

 

 

 

 

 

Yes

New StatusID. If not passed in (or -1), status will not be altered.

Possible statuses available from this API are as follows:

1: New

2: In Progress

3: On Hold

4: Complete

6: Contractor Complete

Comment

String

Yes

Comment to record against each request (added to Work Notes)

WorkRequestID

Integer

No (Yes in our use case)

Which work request to update

User stories:

Valid Creditor provided.

  1. New creditor payment approved in myBuildings

  2. Synergetic agent job will be running on an hourly basis, and picks up an unprocessed invoice (using myBuildings invoices API)

  3. Synergetic creditor identified

  4. New invoice created in Synergetic

...