{"id":327,"date":"2023-02-07T12:03:36","date_gmt":"2023-02-07T12:03:36","guid":{"rendered":"https:\/\/devdocs.resales-online.com\/index.php\/docs\/new-development-updates-api\/authentication\/"},"modified":"2023-02-17T12:24:39","modified_gmt":"2023-02-17T12:24:39","slug":"authentication","status":"publish","type":"docs","link":"https:\/\/devdocs.resales-online.com\/index.php\/docs\/new-development-updates-api\/authentication\/","title":{"rendered":"Authentication"},"content":{"rendered":"\n<p>All PropQ API calls should be authenticated via OAuth2 client credentials flow. <\/p>\n\n\n\n<p>In order to using the API, you must have a <strong>client id<\/strong> and a <strong>client secret<\/strong>. Contact Resales Online for these information. You have to store securely in your side. <strong>Never<\/strong> hardcode them in your code.<\/p>\n\n\n\n<p>Each API call is an HTTP request with at least two headers:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color has-vivid-red-color\"> Content-Type <\/mark><\/code> : always be <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color has-vivid-red-color\"> application\/json <\/mark><\/code>. If this header is missing or not correct, the response code can be incorrect.<\/li>\n\n\n\n<li><code><code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color has-vivid-red-color\"> Authorization <\/mark><\/code><\/code>: must be a string in the following format <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color has-vivid-red-color\"> Bearer <\/mark><\/code>  with  <code><mark style=\"background-color:#eeeeee\" class=\"has-inline-color has-vivid-red-color\"><code><code>&lt;access_token&gt;<\/code><\/code> <\/mark><\/code>  the  is an access token grantted from our server. An access token can be cached in your system (local files, databases, &#8230;) to use in 30 days since it is created.<\/li>\n<\/ul>\n\n\n\n<p>To get a new access token, send and HTTP <code>POST<\/code> request to <code>https:\/\/api.propq.com\/oauth\/token<\/code> with these parameters:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>grant_type<\/code>: always be <code>client_credentials<\/code><\/li>\n\n\n\n<li><code>client_id<\/code>: your client id (should be an integer)<\/li>\n\n\n\n<li><code>client_secret<\/code>: your client secret (should be a string)<\/li>\n<\/ul>\n\n\n\n<p>If the data is valid, the response we be a JSON object with the following fields:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>access_token<\/code>: the access token that you will use in other API requests<\/li>\n\n\n\n<li><code>expires_in<\/code>: the number of seconds that the access token is valid. Currently, this value always be <code>2592000<\/code> (30 days)<\/li>\n\n\n\n<li><code>token_type<\/code>: Always be <code>Bearer<\/code><\/li>\n<\/ul>\n\n\n\n<p>The <em>example<\/em> section gives an example of how to work with Resales Online APIs.<\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\"><a href=\"https:\/\/resource.resales-online.com\/KB\/PropQ-API\/Resales_Online_API_Document_1-7-0.html#section\/Authentication\/OAuth2\"><\/a>OAuth2<\/h2>\n\n\n\n<p>This API use OAuth2 with the client credentials flow<\/p>\n\n\n\n<p><strong>Security Scheme Type: <\/strong>OAuth2<\/p>\n\n\n\n<p><strong>Flow type: <\/strong><code>clientCredentials<\/code><\/p>\n\n\n\n<p><strong>Token URL: <\/strong><code>https:\/\/api.propq.com\/oauth\/token<\/code><\/p>\n\n\n\n<div style=\"height:100px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"featured_media":0,"parent":326,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-327","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/types\/docs"}],"replies":[{"embeddable":true,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/comments?post=327"}],"version-history":[{"count":7,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/327\/revisions"}],"predecessor-version":[{"id":452,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/327\/revisions\/452"}],"up":[{"embeddable":true,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/326"}],"next":[{"title":"Update by unit name","link":"https:\/\/devdocs.resales-online.com\/index.php\/docs\/new-development-updates-api\/update-by-unit-name\/","href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/336"}],"wp:attachment":[{"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/media?parent=327"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}