{"id":289,"date":"2023-01-21T20:29:13","date_gmt":"2023-01-21T17:29:13","guid":{"rendered":"https:\/\/akaunting.com\/hc\/?post_type=docs&#038;p=289"},"modified":"2023-04-25T12:27:36","modified_gmt":"2023-04-25T09:27:36","slug":"restful-api","status":"publish","type":"docs","link":"https:\/\/akaunting.com\/hc\/docs\/developers\/restful-api\/","title":{"rendered":"RESTful API"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Akaunting provides a RESTful API to create, read, update, and delete (CRUD) all entities of Akaunting.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Authentication<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The Akaunting API uses the HTTP Basic authentication. Any user with&nbsp;<code>read-api<\/code>&nbsp;permission may access the API using their email and password. By default, Akaunting gives&nbsp;<code>read-api<\/code>&nbsp;permission to&nbsp;<code>admin<\/code>&nbsp;role.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Permissions for CRUD actions are based on default&nbsp;<a href=\"https:\/\/akaunting.com\/hc\/docs\/developers\/permissions\/\" target=\"_blank\" rel=\"noreferrer noopener\">ACL<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Postman Collections<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">https:\/\/postman.com\/akaunting\/workspace\/akaunting<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Routes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">The full list of API endpoints\/routes is located in the following file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">routes\/api.php<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">You may also add API endpoints to your module:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"php\" class=\"language-php\"><strong>&lt;?php<\/strong>\n\n use Illuminate\\Support\\Facades\\Route;\n\n \/**\n * 'api' middleware and 'api\/my-blog' prefix applied to all routes (including names)\n *\n * @see \\App\\Providers\\Route::register\n *\/\n\n Route::api('my-blog', function () {\n     Route::get('posts\/{post}\/enable', 'Posts@enable')-&gt;name('.posts.enable');\n     Route::get('posts\/{post}\/disable', 'Posts@disable')-&gt;name('.posts.disable');\n     Route::resource('posts', 'Posts');\n     Route::resource('comments', 'Comments');\n });<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Check out the&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/akaunting\/module-my-blog\" target=\"_blank\">My Blog<\/a>&nbsp;module as an example.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">API Resources<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">API Resources allow you to easily and consistently transform models into an array. You can find the API Resources of Akaunting in the following directory:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"bash\" class=\"language-bash\">app\/Http\/Resources<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Feel free to read the documentation of&nbsp;<a rel=\"noreferrer noopener\" href=\"https:\/\/laravel.com\/docs\/eloquent-resources\" target=\"_blank\">Laravel<\/a>&nbsp;for further details on API Resources.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Akaunting provides a RESTful API to create, read, update, and delete (CRUD) all entities of Akaunting. Authentication The Akaunting API uses the HTTP Basic authentication. Any user with&nbsp;read-api&nbsp;permission may access the API using their email and password. By default, Akaunting gives&nbsp;read-api&nbsp;permission to&nbsp;admin&nbsp;role. Permissions for CRUD actions are based on default&nbsp;ACL. Postman Collections Routes The full [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":31,"menu_order":11,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-289","docs","type-docs","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/docs\/289","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/comments?post=289"}],"version-history":[{"count":18,"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/docs\/289\/revisions"}],"predecessor-version":[{"id":1644,"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/docs\/289\/revisions\/1644"}],"up":[{"embeddable":true,"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/docs\/31"}],"wp:attachment":[{"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/media?parent=289"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/akaunting.com\/hc\/wp-json\/wp\/v2\/doc_tag?post=289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}