{"id":981,"date":"2014-08-05T03:49:17","date_gmt":"2014-08-05T03:49:17","guid":{"rendered":"http:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/?p=981"},"modified":"2015-03-04T06:31:40","modified_gmt":"2015-03-04T06:31:40","slug":"api-retrieving-info-affiliates-profile","status":"publish","type":"post","link":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981","title":{"rendered":"API \u2013 Retrieving Info from an Affiliate&#8217;s Profile"},"content":{"rendered":"<p><strong><span style=\"color: #ff0000;\">This documentation is only for developers. If you are not a developer with good PHP coding skills then you have no need to read this.<\/span><\/strong><\/p>\n<p><span style=\"color: #ff0000;\"><strong>It is very hard to troubleshoot another coder\u2019s code. So if you use this documentation and do a custom integration yourself then please note that we cannot offer you any support in terms of what is wrong with your code. You will need to hire us to take a look at your code and correct any mistakes you made.<\/strong><\/span><\/p>\n<div style=\"color: #31708F; background-color: #D9EDF7; border-color: #BCE8F1; border-radius: 4px; margin-bottom: 20px; padding: 15px;\">\n<p>You can also retrieve referrer details <a href=\"http:\/\/www.tipsandtricks-hq.com\/forum\/topic\/manually-setting-the-affiliate-id-and-showing-the-affiliate-id-of-the-referrer\" target=\"_blank\">using shortcode<\/a> offered by this plugin (this doesn&#8217;t require you to use the API).<\/p>\n<\/div>\n<p>This API allows you to retrieve a particular info from your affiliate&#8217;s profile\u00a0via a HTTP GET or POST request. If you want to use this API then you need to enable it from the settings menu. The following is a screenshot of this section in the &#8220;<strong>Integration Related<\/strong>&#8221; settings menu:<\/p>\n<div id=\"attachment_607\" style=\"width: 510px\" class=\"wp-caption alignnone\"><img loading=\"lazy\" decoding=\"async\" aria-describedby=\"caption-attachment-607\" class=\"size-full wp-image-607\" title=\"wp-affiliate-api-remote-post-settings\" src=\"http:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png\" alt=\"\" width=\"500\" height=\"275\" srcset=\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png 500w, https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings-300x165.png 300w\" sizes=\"auto, (max-width: 500px) 100vw, 500px\" \/><p id=\"caption-attachment-607\" class=\"wp-caption-text\">Additional Integration Options Screenshot<\/p><\/div>\n<p>Once you enable it, you can start to send request to a\u00a0URL to retrieve affiliate&#8217;s info programmatically.<\/p>\n<p>You need a minimum of 3 pieces of information to\u00a0do this\u00a0via a HTTP request. These are:<\/p>\n<ul>\n<li>Secret word (the secret word that you have specified in the settings)<\/li>\n<li>Referrer ID (the affiliate ID)<\/li>\n<li>Info\u00a0(the value of the field you want to retrieve)<\/li>\n<\/ul>\n<h2>Option 1. HTTP GET request<\/h2>\n<p>To do this\u00a0via HTTP GET use the following format:<\/p>\n<pre>\r\nhttp:\/\/www.example.com\/wp-content\/plugins\/wp-affiliate-platform\/api\/get_user_data.php?secret=XX&ap_id=YY&info=ZZ\r\n<\/pre>\n<p>Replace the &#8220;example.com&#8221;, &#8220;XX&#8221;, &#8220;YY&#8221;, &#8220;ZZ&#8221; with the appropriate value.<\/p>\n<h4>PHP Code Example<\/h4>\n<p>The following is an example of how to construct this link using PHP. The following will retrieve the &#8220;email&#8221; field value of the affiliate with ID &#8220;tips21&#8221;<\/p>\n<pre>\r\n$secret = \"4bd39e2e4a7bb\";\r\n$referrer = \"tips21\";\r\n$info = \"email\";\r\n$prepared_data = \"?secret=\".$secret.\"&amp;ap_id=\".$referrer.\"&amp;info=\".$info;\r\n$get_url = \"http:\/\/www.example.com\/wp-content\/plugins\/wp-affiliate-platform\/api\/get_user_data.php\".$prepared_data;\r\n\/\/ Execute this GET Request\r\nfile_get_contents($get_url);\r\n<\/pre>\n<h2>Option 2. HTTP POST request<\/h2>\n<p>To use\u00a0HTTP POST use the following format:<\/p>\n<pre>\r\n&lt;form method=\"post\" action=\"http:\/\/www.example.com\/wp-content\/plugins\/wp-affiliate-platform\/api\/get_user_data.php\"&gt;\r\n&lt;input type=\"hidden\" name=\"secret\" value=\"XX\"&gt;\r\n&lt;input type=\"hidden\" name=\"ap_id\" value=\"YY\"&gt;\r\n&lt;input type=\"hidden\" name=\"info\" value=\"ZZ\"&gt;\r\n&lt;input type=submit value=\"Submit Post\"&gt;\r\n&lt;\/form&gt;\r\n<\/pre>\n<p>Replace the &#8220;example.com&#8221;, &#8220;XX&#8221;, &#8220;YY&#8221;, &#8220;ZZ&#8221; with the appropriate value.<\/p>\n<h4>PHP Code Example<\/h4>\n<p>The following PHP example code will retrieve the &#8220;email&#8221; address field value of the affiliate with ID &#8220;tips21&#8221;<\/p>\n<pre>$affiliate_id = \"tips21\"; \/\/ The affiliate ID of the user in question\r\n$info = \"email\"; \/\/What info to retrieve. In this case, the email address.\r\n\r\n\/\/ The Post URL (replace \"example.com\" with your actual domain-name)\r\n$postURL = \"http:\/\/www.example.com\/wp-content\/plugins\/wp-affiliate-platform\/api\/get_user_data.php\";\r\n\r\n\/\/ The Secret key (Get this value from the settings menu of this plugin)\r\n$secret_key = \"4bc67180656782.45045137\";\r\n\r\n\/\/ Prepare the data\r\n$data = array ();\r\n$data['secret'] = $secret_key;\r\n$data['ap_id'] = $affiliate_id;\r\n$data['info'] = $info;\r\n\r\n\/\/ send data to post URL to award the commission\r\n$ch = curl_init ($postURL);\r\ncurl_setopt ($ch, CURLOPT_POST, true);\r\ncurl_setopt ($ch, CURLOPT_POSTFIELDS, $data);\r\ncurl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);\r\n$returnValue = curl_exec ($ch);\r\ncurl_close($ch);<\/pre>\n<p>If the affiliate ID you specified in the request is invalid (doesn&#8217;t exist), then it will show an error. Otherwise, it will show the value of the field.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This documentation is only for developers. If you are not a developer with good PHP coding skills then you have no need to read this. It is very hard to troubleshoot another coder\u2019s code. So if you use this documentation and do a custom integration yourself then please note that we cannot offer you any [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[3],"tags":[11,52,37],"class_list":{"0":"post-981","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-additional-resources","7":"tag-3rd-party-integration","8":"tag-affiliate","9":"tag-affiliate-platform-api","10":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>API \u2013 Retrieving Info from an Affiliate&#039;s Profile<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981\"},\"author\":{\"name\":\"admin\",\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#\/schema\/person\/b3a690506213824832751de546a340fb\"},\"headline\":\"API \u2013 Retrieving Info from an Affiliate&#8217;s Profile\",\"datePublished\":\"2014-08-05T03:49:17+00:00\",\"dateModified\":\"2015-03-04T06:31:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981\"},\"wordCount\":363,\"commentCount\":0,\"image\":{\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png\",\"keywords\":[\"3rd party Integration\",\"affiliate\",\"Affiliate Platform API\"],\"articleSection\":[\"Additional Resources\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981\",\"url\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981\",\"name\":\"API \u2013 Retrieving Info from an Affiliate's Profile\",\"isPartOf\":{\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage\"},\"thumbnailUrl\":\"http:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png\",\"datePublished\":\"2014-08-05T03:49:17+00:00\",\"dateModified\":\"2015-03-04T06:31:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#\/schema\/person\/b3a690506213824832751de546a340fb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage\",\"url\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png\",\"contentUrl\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png\",\"width\":\"500\",\"height\":\"275\",\"caption\":\"Additional Integration Options Screenshot\"},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#website\",\"url\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/\",\"name\":\"WordPress Affiliate Platform\",\"description\":\"Take control of your affiliates and drive more sales\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#\/schema\/person\/b3a690506213824832751de546a340fb\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/secure.gravatar.com\/avatar\/3a21ab4072e533cf470d80fc2f0fd3639872824ade4e23709397e109b24f8857?s=96&d=mm&r=g\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/3a21ab4072e533cf470d80fc2f0fd3639872824ade4e23709397e109b24f8857?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/3a21ab4072e533cf470d80fc2f0fd3639872824ade4e23709397e109b24f8857?s=96&d=mm&r=g\",\"caption\":\"admin\"},\"url\":\"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"API \u2013 Retrieving Info from an Affiliate's Profile","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981","twitter_misc":{"Written by":"admin","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#article","isPartOf":{"@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981"},"author":{"name":"admin","@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#\/schema\/person\/b3a690506213824832751de546a340fb"},"headline":"API \u2013 Retrieving Info from an Affiliate&#8217;s Profile","datePublished":"2014-08-05T03:49:17+00:00","dateModified":"2015-03-04T06:31:40+00:00","mainEntityOfPage":{"@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981"},"wordCount":363,"commentCount":0,"image":{"@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage"},"thumbnailUrl":"http:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png","keywords":["3rd party Integration","affiliate","Affiliate Platform API"],"articleSection":["Additional Resources"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981","url":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981","name":"API \u2013 Retrieving Info from an Affiliate's Profile","isPartOf":{"@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage"},"image":{"@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage"},"thumbnailUrl":"http:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png","datePublished":"2014-08-05T03:49:17+00:00","dateModified":"2015-03-04T06:31:40+00:00","author":{"@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#\/schema\/person\/b3a690506213824832751de546a340fb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/api-retrieving-info-affiliates-profile-981#primaryimage","url":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png","contentUrl":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-content\/uploads\/2010\/04\/wp-affiliate-api-remote-post-settings.png","width":"500","height":"275","caption":"Additional Integration Options Screenshot"},{"@type":"WebSite","@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#website","url":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/","name":"WordPress Affiliate Platform","description":"Take control of your affiliates and drive more sales","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/#\/schema\/person\/b3a690506213824832751de546a340fb","name":"admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/3a21ab4072e533cf470d80fc2f0fd3639872824ade4e23709397e109b24f8857?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/3a21ab4072e533cf470d80fc2f0fd3639872824ade4e23709397e109b24f8857?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/3a21ab4072e533cf470d80fc2f0fd3639872824ade4e23709397e109b24f8857?s=96&d=mm&r=g","caption":"admin"},"url":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/posts\/981","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/comments?post=981"}],"version-history":[{"count":0,"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/posts\/981\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/media?parent=981"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/categories?post=981"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tipsandtricks-hq.com\/wordpress-affiliate\/wp-json\/wp\/v2\/tags?post=981"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}