Railz Dev Posted April 18, 2023 Share Posted April 18, 2023 When Im trying to create a new Contact I'm getting this error. "validation" : { "errors" : [ { "field" : "contact[statement_run]", "message" : "contact[statement_run] is invalid" } ] Any idea? Link to comment Share on other sites More sharing options...
Steel, Mark Posted April 19, 2023 Share Posted April 19, 2023 Hi, Thanks for your question, can you provide us with the request body you are sending please. Thanks Mark Link to comment Share on other sites More sharing options...
Railz Dev Posted April 19, 2023 Author Share Posted April 19, 2023 Hi Mark this is the payload { "contact": { "railzRequestSourceId": "db4424e5551a40cb93a7a06ded8e3c83", "id": "db4424e5551a40cb93a7a06ded8e3c83", "contact_type_ids": [ "Customer" ], "main_contact_person": { "name": "customer1 9f037ec6-4c0b-43ac-ae0f-64bfb916098b", "email": "[email protected]" }, "name": "customer1 9f037ec6-4c0b-43ac-ae0f-64bfb916098b", "currency_id": "CAD", "delivery_address": { "name": "Shipping Address" }, "displayed_as": "Customer 0b2cf704-bb66-42bb-914f-9e89d6033376", "X_path": "/contacts/db4424e5551a40cb93a7a06ded8e3c83", "created_at": "2023-02-16T16:51:39Z", "updated_at": "2023-02-16T16:51:39Z", "links": [ { "href": "https://accounting.na.sageone.com/contacts/customers/18801651", "rel": "alternate", "type": "text/html" } ], "balance": "0.0", "contact_types": [ { "id": "CUSTOMER", "displayed_as": "Customer", "$path": "/contact_types/CUSTOMER" } ], "default_sales_ledger_account": { "id": "b4e9c1f1381d11ecbcc60e97dc3b579b", "displayed_as": "Sales - Products (4000)", "$path": "/ledger_accounts/b4e9c1f1381d11ecbcc60e97dc3b579b", "created_at": "2021-10-28T18:34:38Z", "updated_at": "2021-10-28T18:34:38Z", "ledger_account_group": { "id": "INCOME", "displayed_as": "Income" }, "name": "Sales - Products", "display_name": "Sales - Products", "visible_scopes": [ "journals", "other_receipt", "reporting", "sales" ], "included_in_chart": true, "nominal_code": 4000, "ledger_account_type": { "id": "SALES", "displayed_as": "Revenue", "$path": "/ledger_account_types/SALES" }, "fixed_tax_rate": false, "visible_in_banking": false, "visible_in_expenses": false, "visible_in_journals": true, "visible_in_other_payments": false, "visible_in_other_receipts": true, "visible_in_reporting": true, "visible_in_sales": true, "is_control_account": false, "display_formatted": "4000 - Sales - Products", "cis_materials": false, "tax_instalment": false, "cis_labour": false, "gifi_code": 8000 }, "locale": "en-CA", "main_address": { "id": "4c85f7916ad14de9b2234f60f11e7844", "displayed_as": "", "$path": "/addresses/4c85f7916ad14de9b2234f60f11e7844", "contact": { "id": "db4424e5551a40cb93a7a06ded8e3c83", "displayed_as": "Customer 0b2cf704-bb66-42bb-914f-9e89d6033376", "$path": "/contacts/db4424e5551a40cb93a7a06ded8e3c83" }, "address_type": { "id": "DELIVERY", "displayed_as": "Delivery", "$path": "/address_types/DELIVERY" }, "name": "Main Address", "country": { "id": "CA", "displayed_as": "Canada (CA)", "$path": "/countries/CA" }, "country_group": { "id": "ALL", "displayed_as": "Other", "$path": "/country_groups/ALL" }, "is_main_address": true, "created_at": "2023-02-16T16:51:39Z", "updated_at": "2023-02-16T16:51:39Z" }, "preferred_address": { "id": "4c85f7916ad14de9b2234f60f11e7844", "displayed_as": "", "$path": "/addresses/4c85f7916ad14de9b2234f60f11e7844", "contact": { "id": "db4424e5551a40cb93a7a06ded8e3c83", "displayed_as": "Customer 0b2cf704-bb66-42bb-914f-9e89d6033376", "$path": "/contacts/db4424e5551a40cb93a7a06ded8e3c83" }, "address_type": { "id": "DELIVERY", "displayed_as": "Delivery", "$path": "/address_types/DELIVERY" }, "name": "Main Address", "country": { "id": "CA", "displayed_as": "Canada (CA)", "$path": "/countries/CA" }, "country_group": { "id": "ALL", "displayed_as": "Other", "$path": "/country_groups/ALL" }, "is_main_address": true, "created_at": "2023-02-16T16:51:39Z", "updated_at": "2023-02-16T16:51:39Z" }, "preferred_contact_person": { "id": "49e1e1188283403d81fc107f472ad20b", "displayed_as": "Customer 0b2cf704-bb66-42bb-914f-9e89d6033376", "$path": "/contact_persons/49e1e1188283403d81fc107f472ad20b", "contact_person_types": [ { "id": "ACCOUNTS", "displayed_as": "Accounts", "$path": "/contact_person_types/ACCOUNTS" } ], "name": "Customer 0b2cf704-bb66-42bb-914f-9e89d6033376", "is_main_contact": true, "address": { "id": "4c85f7916ad14de9b2234f60f11e7844", "displayed_as": "", "$path": "/addresses/4c85f7916ad14de9b2234f60f11e7844" }, "created_at": "2023-02-16T16:51:39Z", "updated_at": "2023-02-16T16:51:39Z" }, "bank_account_details": {}, "product_sales_price_type": { "id": "0d7fdb642e8543aa989f7a0849c80f1b", "displayed_as": "Sales Price", "$path": "/product_sales_price_types/0d7fdb642e8543aa989f7a0849c80f1b" }, "deletable": true, "tax_treatment": { "home_tax": true, "eu_tax_registered": false, "eu_not_tax_registered": false, "rest_of_world_tax": false }, "tax_calculation": "", "gdpr_obfuscated": false, "system": false, "has_unfinished_recurring_invoices": false, "cis_registered": false, "ni_based": false, "is_active": true, "gb_based": false, "destination_vat_blocking": false, "send_statements": true, "statement_run": { "id": "statement_delivery_method_print", "name": "By post (PDF Generated)" } }, } Link to comment Share on other sites More sharing options...
Steel, Mark Posted April 20, 2023 Share Posted April 20, 2023 This looks to be the response of a GET request for a contact. You ideally need to start with some requirements for the integration in terms of the fields that you wish to create a new contact with. The ID's that you are passing are system generated and returned when a contact is created, you would see the ID's in the 201 response for the POST request. The API's are used across different regions and tiers of SBCA and not all of the attributes returned for a record are applicable for every region or tier. I would start by building out your POST request using a body containing parameters as below. You can then refer to the docs and add to it as per your integration requirements. { "contact": { "name": "Customer 0b2cf704-bb66-42bb-914f-9e89d6033376", "contact_type_ids": ["CUSTOMER"], "reference": "JH4", "default_sales_ledger_account_id": "b4e9c1f1381d11ecbcc60e97dc3b579b", "locale": "en-CA", "currency_id": "CAD", "main_address": { "address_line_1": "4331 Forbidden Plateau Rd", "address_line_2": "", "city": "Courtenay", "region": "BC", "postal_code": "V9J 1R2", "country_id": "CA", "is_main_address": true }, "main_contact_person": { "contact_person_type_ids": ["SALES", "PURCHASING", "ACCOUNTS", "DELIVERY"], "name": "Railz Dev", "telephone": "", "mobile": "", "email": "", "fax": "", "is_main_contact": true, "is_preferred_contact": true } } } Thanks Mark Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now