POST CUSTOMER INVOICE USING FREEDOM API

SOLVED

AM trying to post customer invoice using freedom API.

But I got this error as per image below

"Object reference not set to an instance of an object."

Parents
  • +1
    verified answer

    Resolved, the problem was invalid TaxCode

  • 0 in reply to Ramadhan Ngallen

    We are having the same issues, what was the tax code supposed to be?

  • 0 in reply to Casper du plessis

    Let me elaborate, we are trying to make a journal entry between 2 GL accounts, and we keep getting the following error.

    HasError"true,
        "ID"null,
        "Message""Object reference not set to an instance of an object.",
        "OperationPerformed""GLTransactionPost",
        "ValidationErrors": []
    does anyone have an example of what such a request's body should look like that works?
  • 0 in reply to Casper du plessis

    Tax code should be based on your company setup tax codes

  • +1 in reply to Casper du plessis
    verified answer

    if your using json should be like this

    {
    "batch": {
    "Transactions":[{      
        "Date":"/Date(1646863200000+0200)/",
        "AccountCode":"Accounting Fees",
        "Reference":"001",
        "TransactionCode":"JNL",
        "Debit":"500"
    },{    
        "Date":"/Date(1646863200000+0200)/",
        "AccountCode":"Accounting Fees",
        "Reference":"001",
        "TransactionCode":"JNL",
        "Credit":"500"
    }]

    and if your using xml should be like this

    <GLTransactionPost xmlns="">Freedom.PastelEvolution.co.za/.../25">
        <batch xmlns:a="">schemas.datacontract.org/.../XMLSchema-instance">
               <Hash i:nil="true" xmlns="">schemas.datacontract.org/.../>

                    <a:Transactions>
                    <a:GLTransactionPostDto> 
                    <a:Date>2022-07-15T00:00:00</a:Date>
                    <a:Reference>XMLTest</a:Reference>
                    <a:TransactionCode>JNL</a:TransactionCode>
                    <a:AccountCode>Rent</a:AccountCode>
                    <a:Debit>222</a:Debit>
                    </a:GLTransactionPostDto>
                    <a:GLTransactionPostDto>
                    <a:Date>2022-07-15T00:00:00</a:Date>
                    <a:Reference>XMLTest</a:Reference>
                    <a:TransactionCode>JNL</a:TransactionCode>
                    <a:AccountCode>Current Account</a:AccountCode>
                    <a:Credit>222</a:Credit>
                    </a:GLTransactionPostDto>
                    </a:Transactions>       
                                                
        </batch>
    </GLTransactionPost>

Reply
  • +1 in reply to Casper du plessis
    verified answer

    if your using json should be like this

    {
    "batch": {
    "Transactions":[{      
        "Date":"/Date(1646863200000+0200)/",
        "AccountCode":"Accounting Fees",
        "Reference":"001",
        "TransactionCode":"JNL",
        "Debit":"500"
    },{    
        "Date":"/Date(1646863200000+0200)/",
        "AccountCode":"Accounting Fees",
        "Reference":"001",
        "TransactionCode":"JNL",
        "Credit":"500"
    }]

    and if your using xml should be like this

    <GLTransactionPost xmlns="">Freedom.PastelEvolution.co.za/.../25">
        <batch xmlns:a="">schemas.datacontract.org/.../XMLSchema-instance">
               <Hash i:nil="true" xmlns="">schemas.datacontract.org/.../>

                    <a:Transactions>
                    <a:GLTransactionPostDto> 
                    <a:Date>2022-07-15T00:00:00</a:Date>
                    <a:Reference>XMLTest</a:Reference>
                    <a:TransactionCode>JNL</a:TransactionCode>
                    <a:AccountCode>Rent</a:AccountCode>
                    <a:Debit>222</a:Debit>
                    </a:GLTransactionPostDto>
                    <a:GLTransactionPostDto>
                    <a:Date>2022-07-15T00:00:00</a:Date>
                    <a:Reference>XMLTest</a:Reference>
                    <a:TransactionCode>JNL</a:TransactionCode>
                    <a:AccountCode>Current Account</a:AccountCode>
                    <a:Credit>222</a:Credit>
                    </a:GLTransactionPostDto>
                    </a:Transactions>       
                                                
        </batch>
    </GLTransactionPost>

Children