0

I'm trying to use the REST API for Journal creation in Financial Force. The path is

services/apexrest/c2g/v1.0/journals/*

I was able to login, and perform the call but I am receiving an error message

<Response [400]>

[{"message":"Unexpected parameter encountered during deserialization: Company at [line:1, column:17]","errorCode":"JSON_PARSER_ERROR"}]

The JSON I'm passing in the body is

{ 
    "Company": "ELIM Company-SEC",
    "Date": "2018-09-01",
    "Currency": "USD",
    "LineItems": [{
            "GeneralLedgerAccount": "181102 - Intermediate Holdings",
            "Value": -11114954.25,
            "LineDescription": "Journal"
        }]
    }

Has anyone used this call before? I'm wondering if there's some other key I have to supply in my JSON call prior to the actual journal entry. The documentation on their website doesn't give any indication that is the case though.

http://help.financialforce.com/accounting-api-rest/2018.1/Journals.htm

Update: I did try sending it as a list, wrapped in [ ] but it still errored, with this message

"Error message": "JSON request body must be an object at [line:1, column:2]", "errorCode": "JSON_PARSER_ERROR"

2 Answers 2

1

Looking at the documentation, it should be an array so your JSON should look like this:

[{ 
    "Company": "ELIM Company-SEC",
    "Date": "2018-09-01",
    "Currency": "USD",
    "LineItems": [{
            "GeneralLedgerAccount": "181102 - Intermediate Holdings",
            "Value": -11114954.25,
            "LineDescription": "Journal"
    }]
}]

I was able to use your XML to create a Journal in FFA, see screenshot of Workbench below (had to change company and GLA name to match my org):

enter image description here

You should have enabled the Accounting Journal API in the Feature Console first, can you confirm you have done that? If you are still having problems, it might be an idea to raise a support ticket with FinancialForce.

8
  • I did try the list as well, sorry should have posted that. It still does not work. Oct 30, 2018 at 19:34
  • will take a look tomorrow for you Oct 30, 2018 at 19:41
  • Edited to show successful response from Workbench. Oct 31, 2018 at 10:53
  • 1
    Can you advise where I can find the "Feature Console" in FF? Oct 31, 2018 at 13:05
  • 1
    I reached out to our FF support and was able to get this resolved. Thanks for your help! Nov 2, 2018 at 16:24
0

The documentation shows, albeit not very explicitly, that the JSON structure it's expecting is a list, not a map:

[{
    "Company": "Merlin Auto AUS",
    <snip>
}]

You need to wrap your map up in [] so it can be deserialized by the Apex on the receiving side.

1
  • I did try the list as well. Sorry I should have mentioned that. It returns a different error message when you try a list."message": "JSON request body must be an object at [line:1, column:2]", "errorCode": "JSON_PARSER_ERROR" Oct 30, 2018 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .