{"id":3783,"date":"2021-01-14T19:52:44","date_gmt":"2021-01-14T17:52:44","guid":{"rendered":"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-module-apis\/update-journal\/"},"modified":"2021-02-17T13:41:51","modified_gmt":"2021-02-17T11:41:51","slug":"api-update-journal","status":"publish","type":"docs","link":"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-apis-v1\/api-update-journal\/","title":{"rendered":"API: Update Journal"},"content":{"rendered":"<p>The purpose of this API is to update an existing journal.<\/p>\n<h4>Request<\/h4>\n<table style=\"width: auto;\">\n<tbody>\n<tr>\n<th style=\"text-align: left;\">API Name<\/th>\n<td>UpdateJournal<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">URL<\/th>\n<td>https:\/\/your_account.modulus.biz\/api\/bk\/v1\/UpdateJournal?token=YOUR_TOKEN<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Method<\/th>\n<td>PUT<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Source<\/th>\n<td>Third Party Server<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Recipient<\/th>\n<td>modulus\u00ae Server<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">Content Type<\/th>\n<td>application\/json<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Query String Parameters<\/h4>\n<table style=\"width: auto\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"text-align:left;\">token<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>Your authentication token.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Payload Parameters<\/h4>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th style=\"text-align: left;\">journal_id<\/th>\n<td>Yes<\/td>\n<td>Number<\/td>\n<td>Has to be initially created by the same integration app, and status is either pending or review.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">journal_notes<\/th>\n<td>No<\/td>\n<td>Text<\/td>\n<td>Journal notes if any.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">reference_number<\/th>\n<td>No<\/td>\n<td>Text<\/td>\n<td>Journal reference number.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">journal_entries<\/th>\n<td>Yes<\/td>\n<td>Array<\/td>\n<td>An array that contains at least two entries.<br \/>\n                Credit amount must be equal to debit amount.<br \/>\n                Journal entries have the structure explained <a href=\"#journalEnteries\">here<\/a>.\n            <\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"journalEnteries\">Journal Entry Parameter Details<\/h4>\n<table>\n<thead>\n<tr>\n<th>Parameter<\/th>\n<th>Required<\/th>\n<th>Type<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tr>\n<th style=\"text-align: left;\">account_code<\/th>\n<td>Yes<\/td>\n<td>Text<\/td>\n<td>Has to match a non-disabled leaf account in CoA.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">cost_center_id<\/th>\n<td>No<\/td>\n<td>Number<\/td>\n<td>An integer that can be used with revenue \/ expense entries to indicate the cost center to which the JV is posted.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">journal_entry_notes<\/th>\n<td>No<\/td>\n<td>Text<\/td>\n<td>Journal entry notes if any.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">base_currency_debit_amount<\/th>\n<td>Yes<\/td>\n<td>Decimal Number<\/td>\n<td>Has to be equal to credit amount.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">foreign_currency_debit_amount<\/th>\n<td>Yes<\/td>\n<td>Decimal Number<\/td>\n<td>Used in case of foreign currency transaction.<br \/>\n            In case used, has to be of same value as foreign currency credit amount.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">base_currency_credit_amount<\/th>\n<td>Yes<\/td>\n<td>Decimal Number<\/td>\n<td>Has to be equal to debit amount.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">foreign_currency_credit_amount<\/th>\n<td>No<\/td>\n<td>Decimal Number<\/td>\n<td>Used in case of foreign currency transaction.<br \/>\n            In case used, has to be of same value as foreign currency debit amount.<\/td>\n<\/tr>\n<tr>\n<th style=\"text-align: left;\">foreign_currency_id<\/th>\n<td>No<\/td>\n<td>Number<\/td>\n<td>Used in case of foreign currency transaction.<\/td>\n<\/tr>\n<\/table>\n<h4>Responses<\/h4>\n<table style=\"width: auto;\">\n<thead>\n<tr>\n<th>HTTP Status<\/th>\n<th>result<\/th>\n<th>title<\/th>\n<th>message<\/th>\n<th>object<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<th colspan=\"5\">Success Responses<\/th>\n<\/tr>\n<tr>\n<td>200 OK<\/td>\n<td>true<\/td>\n<td>Success<\/td>\n<td>New journal updated successfully<\/td>\n<td>\n<pre><code class=\"json\">{\r\n    \"updated_journal_id\": xxx,\r\n    \"updated_date_time\": \"yyy-mm-dd hh:MM:ss\"\r\n}<\/code><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<th colspan=\"5\">Failure Responses<\/th>\n<\/tr>\n<tr>\n<td>400 Bad Request<\/td>\n<td>false<\/td>\n<td>Bad Request<\/td>\n<td>Error message as elaborated <a href=\"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-apis-v1\/error-codes\/\" target=\"_blank\">here<\/a>.<\/td>\n<td>\n<pre><code class=\"json\">{\r\n    \"error_code\": xxx\r\n}<\/code><\/pre>\n<p>Error code as elaborated <a href=\"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-apis-v1\/error-codes\/\" target=\"_blank\">here<\/a>.<\/td>\n<\/tr>\n<tr>\n<td>500 Internal Server Error<\/td>\n<td>false<\/td>\n<td>Internal Server Error<\/td>\n<td>Error message as elaborated <a href=\"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-apis-v1\/error-codes\/\" target=\"_blank\">here<\/a>.<\/td>\n<td>\n<pre><code class=\"json\">{\r\n    \"error_code\": xxx\r\n}<\/code><\/pre>\n<p>Error code as elaborated <a href=\"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-apis-v1\/error-codes\/\" target=\"_blank\">here<\/a>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Example 1<\/h4>\n<table style=\"width: auto;\">\n<tbody>\n<tr>\n<th>Request<\/th>\n<td>\n<pre><code class=\"json\">curl <span style=\"white-space: nowrap;\">--request PUT 'https:\/\/your_account.modulus.biz\/api\/bk\/v1\/UpdateJournal?token=YOUR_TOKEN' \\<\/span>--header 'Content-Type: application\/json' \\\r\n--data-raw '{\r\n    \"journal_id\": 3439,\r\n    \"journal_notes\": \"Sunt in culpa qui officia deserunt mollit anim id est laborum.\",\r\n    \"reference_number\": \"AJ-23-mn-87\",\r\n    \"journal_entries\": [\r\n        {\r\n            \"account_code\": \"1.3\",\r\n            \"cost_center_id\" : null,\r\n            \"journal_entry_notes\": \"Duis aute irure dolor in reprehenderit.\",\r\n            \"base_currency_debit_amount\": 100.00,\r\n            \"foreign_currency_debit_amount\": 100.00,\r\n            \"base_currency_credit_amount\": 0.00,\r\n            \"foreign_currency_credit_amount\": 0.00,\r\n            \"foreign_currency\": \"EGP\"\r\n        },\r\n        {\r\n            \"account_code\": \"1.4.2.1\",\r\n            \"cost_center_id\": null,\r\n            \"journal_entry_notes\": \"Excepteur sint occaecat.\",\r\n            \"base_currency_debit_amount\": 0.00,\r\n            \"foreign_currency_debit_amount\": 0.00,\r\n            \"base_currency_credit_amount\": 100.00,\r\n            \"foreign_currency_credit_amount\": 100.00,\r\n            \"foreign_currency\": \"EGP\"\r\n        }\r\n    ]\r\n}'<\/code><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<th>200 OK<\/th>\n<td>\n<pre><code class=\"json\">{\r\n    \"result\": true,\r\n    \"title\": \"Success\",\r\n    \"message\": \"Journal updated successfully.\",\r\n    \"object\": {\r\n        \"updated_journal_id\": 3439,\r\n        \"updated_date_time\": \"2021-01-14 20:00:15\"\r\n    }\r\n}<\/code>\r\n                <\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4>Example 2<\/h4>\n<table style=\"width: auto;\">\n<tbody>\n<tr>\n<th>Request<\/th>\n<td>\n<pre><code class=\"json\">curl <span style=\"white-space: nowrap;\">--request PUT 'https:\/\/your_account.modulus.biz\/api\/bk\/v1\/UpdateJournal?token=ddd871b104153e1da4c10713ec691d77' \\<\/span>\r\n--header 'Content-Type: application\/json' \\\r\n--data-raw '{\r\n    \"journal_id\": null,\r\n    \"journal_notes\": \"Nisi scelerisque eu ultrices vitae auctor eu augue ut lectus.\",\r\n    \"reference_number\": \"AJ-23-mn-87\",\r\n    \"journal_entries\": [\r\n        {\r\n            \"account_code\": \"1.355\",\r\n            \"cost_center_id\" : 2,\r\n            \"journal_entry_notes\": \"Amet est placerat in egestas erat imperdiet.\",\r\n            \"base_currency_debit_amount\": 100.45,\r\n            \"foreign_currency_debit_amount\": 100.45,\r\n            \"base_currency_credit_amount\": 0.00,\r\n            \"foreign_currency_credit_amount\": 0.00,\r\n            \"foreign_currency\": \"\"\r\n        },\r\n        {\r\n            \"account_code\": \"1.4.2.1\",\r\n            \"cost_center_id\": null,\r\n            \"journal_entry_notes\": \"Sed vulputate mi sit amet mauris commodo.\",\r\n            \"base_currency_debit_amount\": 0.00,\r\n            \"foreign_currency_debit_amount\": 0.00,\r\n            \"base_currency_credit_amount\": 100.45,\r\n            \"foreign_currency_credit_amount\": 100.45,\r\n            \"foreign_currency\": \"USD\"\r\n        }\r\n    ]\r\n}'<\/code><\/pre>\n<\/td>\n<\/tr>\n<tr>\n<th>400 Bad Request<\/th>\n<td>\n<pre><code class=\"json\">{\r\n    \"result\": false,\r\n    \"title\": \"Bad Request\",\r\n    \"message\": \"Failed to update journal. Invalid account code for journal entry.\",\r\n    \"object\": {\r\n        \"error_code\": 1239\r\n    }\r\n}                        \r\n                    <\/code>\r\n                <\/pre>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"featured_media":0,"parent":3778,"menu_order":2,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"comment_count":0,"_links":{"self":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/3783"}],"collection":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/comments?post=3783"}],"version-history":[{"count":23,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/3783\/revisions"}],"predecessor-version":[{"id":3960,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/3783\/revisions\/3960"}],"up":[{"embeddable":true,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/3778"}],"next":[{"title":"API: Delete Journal","link":"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-apis-v1\/api-delete-journal\/","href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/3784"}],"prev":[{"title":"API: Create Journal","link":"https:\/\/modulus.help\/kb\/docs\/documentation\/bookkeeping-apis-v1\/api-create-journal\/","href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/docs\/3779"}],"wp:attachment":[{"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/media?parent=3783"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/modulus.help\/kb\/wp-json\/wp\/v2\/doc_tag?post=3783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}