{"id":214,"date":"2024-05-17T02:11:12","date_gmt":"2024-05-17T02:11:12","guid":{"rendered":"https:\/\/docs.quantri.online\/?docs=developer-guide\/section-1"},"modified":"2025-07-07T02:37:29","modified_gmt":"2025-07-07T02:37:29","slug":"section-1","status":"publish","type":"docs","link":"https:\/\/docs.quantri.online\/?docs=developer-guide\/business-management\/section-1","title":{"rendered":"Thi\u1ebft l\u1eadp API V8"},"content":{"rendered":"\n<h2 class=\"wp-block-heading has-large-font-size\"><strong>1. Y\u00eau c\u1ea7u<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u0110\u00e3 c\u00e0i \u0111\u1eb7t v\u00e0 c\u1ea5u h\u00ecnh OpenSSL PHP Extension.<\/li>\n\n\n\n<li>Ph\u1ea3i \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh HTTPS\/SSL.<\/li>\n\n\n\n<li>PHP version 5.5.9, or 7.0 ho\u1eb7c l\u1edbn h\u01a1n.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\"><strong>2. JSON AP<\/strong>I<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">&#8211; Tr\u01b0\u1edbc khi b\u1eaft \u0111\u1ea7u g\u1ecdi endpoints h\u00e3y ki\u1ec3m tra v\u00e0 thi\u1ebft l\u1eadp c\u00e1c ph\u1ea7n sau:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li class=\"has-small-font-size\">C\u00e0i \u0111\u1eb7t Composer: composer install<\/li>\n\n\n\n<li class=\"has-small-font-size\">T\u1ea1o private v\u00e0 public.key cho OAUTH2\n<ul class=\"wp-block-list\">\n<li class=\"has-small-font-size\">M\u1edf terminal v\u00e0 \u0111i \u0111\u1ebfn <strong><em>{{suitecrm.root}}\/Api\/V8\/OAuth2<\/em><\/strong><\/li>\n\n\n\n<li class=\"has-small-font-size\">T\u1ea1o private key:<strong><em> openssl genrsa -out private.key 2048<\/em><\/strong><\/li>\n\n\n\n<li class=\"has-small-font-size\">T\u1ea1o public key: <strong><em>openssl rsa -in private.key -pubout -out public.key<\/em><\/strong><\/li>\n\n\n\n<li class=\"has-small-font-size\">Ph\u00e2n quy\u1ec1n 600 ho\u1eb7c 660 cho 2 file key n\u00e0y: \n<ul class=\"wp-block-list\">\n<li class=\"has-small-font-size\"><strong><em>sudo chmod 600 private.key public.key<\/em><\/strong><\/li>\n\n\n\n<li class=\"has-small-font-size\"><strong>sudo chown www-data:www-data p*.key<\/strong><\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li class=\"has-small-font-size\">C\u00f3 th\u1ec3 t\u1ea1o m\u1edbi key m\u00e3 h\u00f3a OAUTH2 (<strong><em>Optional<\/em><\/strong>)\n<ul class=\"wp-block-list\">\n<li>AuthorizationServer c\u1ee7a OAuth2 c\u1ea7n thi\u1ebft l\u1eadp kh\u00f3a m\u00e3 h\u00f3a v\u00ec l\u00fd do b\u1ea3o m\u1eadt. Kh\u00f3a n\u00e0y \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ea1o trong qu\u00e1 tr\u00ecnh c\u00e0i \u0111\u1eb7t BM v\u00e0 \u0111\u01b0\u1ee3c l\u01b0u tr\u1eef trong <strong><em>config.php<\/em><\/strong> \u1edf ph\u1ea7n &#8220;<strong><em>oauth2_encryption_key<\/em><\/strong>&#8220;. <\/li>\n\n\n\n<li class=\"has-small-font-size\">N\u1ebfu mu\u1ed1n thay \u0111\u1ed5i gi\u00e1 tr\u1ecb c\u1ee7a n\u00f3, c\u00f3 th\u1ec3 t\u1ea1o m\u1ed9t key m\u1edbi b\u1eb1ng c\u00e1ch ch\u1ea1y: <strong><em>php -r &#8216;echo base64_encode(random_bytes(32)), PHP_EOL;&#8217;<\/em><\/strong><\/li>\n\n\n\n<li class=\"has-small-font-size\">Sau \u0111\u00f3 copy key tr\u1ea3 v\u1ec1 v\u00e0 d\u00e1n v\u00e0o <strong><em>oauth2_encryption_key<\/em><\/strong> \u1edf config.php<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\"><strong>3. Authentication\u00a0<\/strong><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">BM cho ph\u00e9p 2 lo\u1ea1i grant types:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Password<\/li>\n\n\n\n<li>Client credential<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>Parameter<\/td><td>M\u00f4 t\u1ea3<\/td><\/tr><tr><td><strong>Access Token URL<\/strong><\/td><td>{{suitecrm.url}}\/Api\/access_token<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading has-large-font-size\"><strong>4. Tham kh\u1ea3o th\u00eam<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/docs.suitecrm.com\/developer\/api\/developer-setup-guide\/\">https:\/\/docs.suitecrm.com\/developer\/api\/developer-setup-guide\/<\/a> <\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>1. Y\u00eau c\u1ea7u 2. JSON API &#8211; Tr\u01b0\u1edbc khi b\u1eaft \u0111\u1ea7u g\u1ecdi endpoints h\u00e3y ki\u1ec3m tra v\u00e0 thi\u1ebft l\u1eadp c\u00e1c ph\u1ea7n sau: 3. Authentication\u00a0 BM cho ph\u00e9p 2 lo\u1ea1i grant types: Parameter M\u00f4 t\u1ea3 Access Token URL {{suitecrm.url}}\/Api\/access_token 4. Tham kh\u1ea3o th\u00eam<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":281,"menu_order":3,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-214","docs","type-docs","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/docs.quantri.online\/index.php?rest_route=\/wp\/v2\/docs\/214","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/docs.quantri.online\/index.php?rest_route=\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/docs.quantri.online\/index.php?rest_route=\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/docs.quantri.online\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.quantri.online\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=214"}],"version-history":[{"count":3,"href":"https:\/\/docs.quantri.online\/index.php?rest_route=\/wp\/v2\/docs\/214\/revisions"}],"predecessor-version":[{"id":268,"href":"https:\/\/docs.quantri.online\/index.php?rest_route=\/wp\/v2\/docs\/214\/revisions\/268"}],"up":[{"embeddable":true,"href":"https:\/\/docs.quantri.online\/index.php?rest_route=\/wp\/v2\/docs\/281"}],"wp:attachment":[{"href":"https:\/\/docs.quantri.online\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=214"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/docs.quantri.online\/index.php?rest_route=%2Fwp%2Fv2%2Fdoc_tag&post=214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}