{"id":280,"date":"2023-02-02T15:41:07","date_gmt":"2023-02-02T15:41:07","guid":{"rendered":"https:\/\/devdocs.resales-online.com\/index.php\/docs\/api-to-create-webapi-keys\/documentation\/"},"modified":"2023-02-17T12:24:33","modified_gmt":"2023-02-17T12:24:33","slug":"documentation","status":"publish","type":"docs","link":"https:\/\/devdocs.resales-online.com\/index.php\/docs\/api-to-create-webapi-keys\/documentation\/","title":{"rendered":"Documentation"},"content":{"rendered":"\n<p>Full documentation for developers.<\/p>\n\n\n\n<div style=\"height:70px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Configuration<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">End point<\/h3>\n\n\n\n<p>Production: https:\/\/8kdxv7r3ke.execute-api.eu-central-1.amazonaws.com\/prod\/createapikey<\/p>\n\n\n\n<p>Development: https:\/\/s7xv5kenvf.execute-api.ap-southeast-1.amazonaws.com\/dev\/createapikey<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Token<\/h3>\n\n\n\n<p>For this API to work you must have a Token. Request one to our IT team.<\/p>\n\n\n\n<div style=\"height:70px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Formatting the request<\/h2>\n\n\n\n<p>The request must include the authentication and requested data on the body content.<br>Must be on Json format and only by POST method.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Authentication<\/h3>\n\n\n\n<p>The authentication should be done including the header \u201cAuthorization:\u201d with the \u201cBearer token\u201d.<\/p>\n\n\n\n<pre class=\"wp-block-code has-text-color has-background\" style=\"color:#333333;background-color:#abb7c226;font-size:0.9em\"><code>\n        curl_setopt($ch, CURLOPT_HTTPHEADER, array(\n            'Accept:application\/json',\n            'Content-Type:application\/json',\n            'Authorization:Bearer 073ljkaoiufa98793lkja90d87a9sduf3leujeYA'\n        ));\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Data<\/h3>\n\n\n\n<p>The body request must be in Json format with the following needed data:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>UserName<\/li>\n\n\n\n<li>serverIp<\/li>\n\n\n\n<li>source<\/li>\n\n\n\n<li>webDeveloperEmail (optional)<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code has-text-color has-background\" style=\"color:#333333;background-color:#abb7c22b;font-size:0.9em\"><code>\n  {\n    \"userName\": \"agentname@demo\",\n    \"serverIP\": \"15.79.40.86\",\n    \"source\": \"Your company\",\n    \"webDeveloperEmail\": \"webdeveloper@mydomain.com\"\n  }\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<div style=\"height:70px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Flow<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Pre-requisites<\/h3>\n\n\n\n<p>The Resales-Online userName is unique per user.<br>The user belongs to a Real Estate Agency.<br>The user is an active Account Administrator.<br>Each Real Estate Agency ONLY can have one API key per IP.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Processing<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Validation of the Authorization Bearer<\/li>\n\n\n\n<li>Check if all required body data is included<\/li>\n\n\n\n<li>Validation of UserName. If exists and is an active RSO user<\/li>\n\n\n\n<li>Check if there is an existing API key for the given IP and the Agency linked to that username<\/li>\n\n\n\n<li>Create Web API key on Version 6.\n<ol class=\"wp-block-list\">\n<li>Create 4 predefined filters<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Send Web API data on response<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n\n\n\n<div style=\"height:70px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Output<\/h2>\n\n\n\n<p>The output will contain the request status: error or success<br><\/p>\n\n\n\n<p>If error. A description of the error will be given. E.g.:<\/p>\n\n\n\n<pre class=\"wp-block-code has-text-color has-background\" style=\"color:#333333;background-color:#abb7c22b;font-size:0.9em\"><code>\n  {\n    \"status\": \"error\",\n    \"error\": {\n        \"number\": 401,\n        \"description\": \"Not valid authentication token\"\n    },\n    \"data\": {\n        \"request_datetime\": \"2022-11-24 09:11:52\"\n    }\n  }\n<\/code><\/pre>\n\n\n\n<p>If success. The Web API data will be returned. E.g.: <\/p>\n\n\n\n<pre class=\"wp-block-code has-text-color has-background\" style=\"color:#333333;background-color:#abb7c22b;font-size:0.9em\"><code>\n   {\n    \"status\": \"success\",\n    \"error\": {},\n    \"data\": {\n        \"P1\": \"9858974\",\n        \"P2\": \"a8813b46eccb1dsqed0036fbbd1e5a9027fdc563\",\n        \"ServerIP\": \"15.179.49.86\",\n        \"APIVersion\": \"API V6\",\n        \"AgencyName\": \"DEMO AGENCY\",\n        \"request_datetime\": \"2022-11-23 13:11:27\"\n    }\n   }\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Troubleshooting <\/h3>\n\n\n\n<figure class=\"wp-block-table is-style-regular has-small-font-size\"><table><thead><tr><th class=\"has-text-align-center\" data-align=\"center\">Response code<\/th><th class=\"has-text-align-center\" data-align=\"center\">Error number<\/th><th class=\"has-text-align-center\" data-align=\"center\">Error description<\/th><th class=\"has-text-align-center\" data-align=\"center\">Reason<\/th><th class=\"has-text-align-center\" data-align=\"center\">Solution<\/th><\/tr><\/thead><tbody><tr><td class=\"has-text-align-center\" data-align=\"center\">401<\/td><td class=\"has-text-align-center\" data-align=\"center\">401<\/td><td class=\"has-text-align-center\" data-align=\"center\">Not valid authentication token<\/td><td class=\"has-text-align-center\" data-align=\"center\">The header &#8220;Authentication Bearer&#8221; is missing or not valid.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Review your request headers and verify includes the correct token<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">400<\/td><td class=\"has-text-align-center\" data-align=\"center\">101<\/td><td class=\"has-text-align-center\" data-align=\"center\">(xx) is mandatory.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Mandatory data is missing.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Verify all mandatory parameters are included on the body request in a JSON format.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">400<\/td><td class=\"has-text-align-center\" data-align=\"center\">102<\/td><td class=\"has-text-align-center\" data-align=\"center\">(xx) is not a valid IP address.<\/td><td class=\"has-text-align-center\" data-align=\"center\">The parsed IP is not well formed.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Verify the parsed serverIP is correct.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">400<\/td><td class=\"has-text-align-center\" data-align=\"center\">103<\/td><td class=\"has-text-align-center\" data-align=\"center\">UserName does not exist<\/td><td class=\"has-text-align-center\" data-align=\"center\">The parsed UserName is not a valid RSO user.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Confirm the userName with the Real Estate Agent<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">400<\/td><td class=\"has-text-align-center\" data-align=\"center\">104<\/td><td class=\"has-text-align-center\" data-align=\"center\">The given UserName is not an active account administrator.<\/td><td class=\"has-text-align-center\" data-align=\"center\">The parsed UserName is not valid. Because must be an Admin User.<\/td><td class=\"has-text-align-center\" data-align=\"center\">Confirm with the Real Estate Agency if the given userName is an Admin user.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">200<\/td><td class=\"has-text-align-center\" data-align=\"center\">110<\/td><td class=\"has-text-align-center\" data-align=\"center\">There is an existing API key for the server IP: xx.xx.xx.xx<\/td><td class=\"has-text-align-center\" data-align=\"center\">The Real Estate Agency have already an API key for the parset serverIP<\/td><td class=\"has-text-align-center\" data-align=\"center\">Ask RSO IT support.<\/td><\/tr><tr><td class=\"has-text-align-center\" data-align=\"center\">500\/501<\/td><td class=\"has-text-align-center\" data-align=\"center\">501<\/td><td class=\"has-text-align-center\" data-align=\"center\">Server error<\/td><td class=\"has-text-align-center\" data-align=\"center\"><\/td><td class=\"has-text-align-center\" data-align=\"center\">Ask RSO IT support.<\/td><\/tr><\/tbody><\/table><\/figure>\n","protected":false},"featured_media":0,"parent":243,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-280","docs","type-docs","status-publish","hentry"],"comment_count":0,"_links":{"self":[{"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/280","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=280"}],"version-history":[{"count":5,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/280\/revisions"}],"predecessor-version":[{"id":312,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/280\/revisions\/312"}],"up":[{"embeddable":true,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/243"}],"next":[{"title":"Version History","link":"https:\/\/devdocs.resales-online.com\/index.php\/docs\/api-to-create-webapi-keys\/version-history\/","href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/docs\/279"}],"wp:attachment":[{"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/media?parent=280"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/devdocs.resales-online.com\/index.php\/wp-json\/wp\/v2\/doc_tag?post=280"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}