### Get Products - cURL Request Example Source: https://doc.profitshare.com/affiliates/docs/index Example of how to make a GET request to the affiliate-products endpoint using cURL, demonstrating how to apply filters for advertisers. ```bash curl -x GET "[API_URL]/affiliate-products/? filters[advertiser]=45,41" ``` -------------------------------- ### Get Affiliate Campaigns Example Request Source: https://doc.profitshare.com/affiliates/docs/index Example cURL command to fetch affiliate campaigns. Note: The '-x GET' syntax is unusual for cURL and might be a typo in the original documentation; typically, it would be 'curl GET ...' or simply 'curl ...' for GET requests. ```bash curl -x GET /affiliate-campaigns/ ``` -------------------------------- ### API Request Example using cURL Source: https://doc.profitshare.com/affiliates/docs/index An example of how to make a GET request to the affiliate-commissions endpoint using cURL, demonstrating the use of filters for status and date range. ```bash curl -x GET /affiliate-commissions/? filters[status]=pending&filters[date_from]=2013-01-15&filters[date_to]=2013-01-16 ``` -------------------------------- ### Get Products - JSON Response Example Source: https://doc.profitshare.com/affiliates/docs/index Example of a successful JSON response when retrieving product details. It includes pagination information and a list of products with their attributes. ```json HTTP/1.1 200 OK { Date: Tue, 17 Jul 2012 14:55:35 GMT Server: Profitshare Content-Length: 795 Connection: close Content-Type: text/json { "result": { "current_page": 1, "total_pages": 1, "records_per_page": 20, "products": [ { "link":"http://www.test.ro/test/test", "name":"Laptop Lenovo", "image":"http://static.profitshare.ro/sfsd/sdfsdf.jpg", "price_vat":1299, "price":1047.58, "advertiser_id":41, "advertiser_name":"test.ro", "category_name":"Laptopuri" }, { "link":"http://www.test.ro/test/test ", "name":"Laptop Lenovo", "image":"http://static.profitshare.ro/sfsd/sdfsdf.jpg", "price_vat":1299, "price":1047.58, "advertiser_id":41, "advertiser_name":"test.ro", "category_name":"Laptopuri" }, … ] } } } ``` -------------------------------- ### Get Vouchers - cURL Request Example Source: https://doc.profitshare.com/affiliates/docs/index Example of a cURL command to retrieve vouchers, showcasing various optional parameters for filtering by advertiser ID, name, type, exclusivity, validity, and image presence. ```bash curl -x GET "[API_URL]/affiliate-vouchers/?advertiser_id=1234&name=Name&type=code&exclusivity=1&valid=1&image=1&page=1" ``` -------------------------------- ### Retrieve Affiliate Feeds using cURL Source: https://doc.profitshare.com/affiliates/docs/index This example shows how to fetch available affiliate feeds using the cURL command. It specifies the GET method and the endpoint for affiliate feeds, along with necessary headers. ```bash curl -x GET "[API_URL]/affiliate-feeds/" ``` -------------------------------- ### Get Commission Details Example Request Source: https://doc.profitshare.com/affiliates/docs/index Example cURL command to retrieve commission details, filtering by a specific order number. The request includes necessary authentication and content type headers. ```bash curl -x GET "[API_URL]/affiliate-commissions-details/?order_number=1234553" ``` -------------------------------- ### Get Feed Details - JSON Response Example Source: https://doc.profitshare.com/affiliates/docs/index Example of a successful JSON response when retrieving feed details. It includes pagination information and a list of feeds with their associated advertisers. ```json HTTP/1.1 200 OK { Date: Tue, 17 Jul 2012 14:55:35 GMT Server: Profitshare Content-Length: 795 Connection: close Content-Type: text/json { "result": { "current_page": 1, "total_pages": 1, "records_per_page": 20, "feeds": [ { "link":"http://profitshare.ro/", "type":"csv", "name":"Test feed name", "created_at": "2024-07-01 00:00:00", "updated_at": "2024-07-02 03:10:20", "status": "active", "advertisers": { { "id": 35, "name": "eMAG.ro" } } } … ] } } } ``` -------------------------------- ### API Success Response Example Source: https://doc.profitshare.com/affiliates/docs/index An example of a successful HTTP 200 OK response from the Profitshare API, detailing the structure of the response body which includes a list of commission results. ```json HTTP/1.1 200 OK { "Date": Thu, 17 Jul 2023 14:52:55 GMT, "Server": profitshare.ro, "Content-Length": 795, "Connection": close, "Content-Type": text/json, "Response body": { "result":[ { "order_date_time": "2024-01-01 05:00:00", "status": "approved", "last_update": "2024-01-15 00:00:00", "hash": "12313sadfasc234", "referer_page": "https://google.ro/", "click_date": "2024-01-01 00:00:00", "id_advertiser": "123", "products": [ { "name" => "Product name", "code" => "123", "part_no" => "ZXC123", "amount" => "139.99", "commission" => "13.99", "status" => "approved", }, { "name" => "Product name 2", "code" => "345", "part_no" => "ZXC345", "amount" => "159.99", "commission" => "15.99", "status" => "canceled", }, ], }, ] } } ``` -------------------------------- ### Create Affiliate Link using cURL Source: https://doc.profitshare.com/affiliates/docs/index This example demonstrates how to create an affiliate link using the cURL command-line tool. It requires the API URL and specific headers for authentication and content negotiation. ```bash curl -x POST "[API_URL]/affiliate-links/" ``` -------------------------------- ### Error Response Example Source: https://doc.profitshare.com/affiliates/docs/index An example of an error response, specifically a 400 Bad Request, indicating a problem with the request, such as a missing contract finalization. ```json { "errors": "Please finalize your contract in order to generate links" } ``` -------------------------------- ### GET /affiliate-products/ Source: https://doc.profitshare.com/affiliates/docs/index Retrieves details about products. The results can be filtered by providing additional parameters. ```APIDOC ## GET /affiliate-products/ ### Description Retrieves details about products. The results can be filtered by providing additional parameters. ### Method GET ### Endpoint [API_URL]/affiliate-products/ ### Query Parameters - **filters[advertiser]** (string) - Optional - Filter products by advertiser ID(s) (e.g., '45,41'). - **filters[part_no]** (string) - Optional - Filter products by model or part number (SKU). - **page** (number) - Optional - Specifies the page number for paginated results. Each page contains 20 results. ### Request Example ``` curl -x GET "[API_URL]/affiliate-products/?filters[advertiser]=45,41" ``` ### Headers - **Host**: api.profitshare.ro - **X-PS-Client**: test-account - **X-PS-Accept**: json - **X-PS-Auth**: 90a6d325e982f764f86a7e248edf6a660d4ee833 ### Response #### Success Response (200) - **link** (string) - The direct link to the product. - **name** (string) - The name of the product. - **price_vat** (number) - The price of the product including VAT. - **price** (number) - The price of the product excluding VAT. - **advertiser_name** (string) - The name of the advertiser. - **category_name** (string) - The category of the product. - **advertiser_id** (number) - The unique ID of the advertiser. #### Response Example ```json { "result": { "current_page": 1, "total_pages": 1, "records_per_page": 20, "products": [ { "link": "http://www.test.ro/test/test", "name": "Laptop Lenovo", "image": "http://static.profitshare.ro/sfsd/sdfsdf.jpg", "price_vat": 1299, "price": 1047.58, "advertiser_id": 41, "advertiser_name": "test.ro", "category_name": "Laptopuri" } ] } } ``` ``` -------------------------------- ### GET /affiliate-vouchers/ Source: https://doc.profitshare.com/affiliates/docs/index Retrieves details about vouchers. The results can be filtered by providing additional parameters. ```APIDOC ## GET /affiliate-vouchers/ ### Description Retrieves details about vouchers. The results can be filtered by providing additional parameters. ### Method GET ### Endpoint [API_URL]/affiliate-vouchers/ ### Query Parameters - **advertiser_id** (number) - Optional - Filter vouchers by advertiser ID. - **name** (string) - Optional - Filter vouchers by name. - **type** (string) - Optional - Filter vouchers by type (e.g., 'code'). - **exclusivity** (number) - Optional - Filter by exclusivity (1 for exclusive, 0 for non-exclusive). - **valid** (number) - Optional - Filter by validity (1 for valid, 0 for invalid). - **image** (number) - Optional - Filter by whether the voucher has an image (1 for image, 0 for no image). - **page** (number) - Optional - Specifies the page number for paginated results. Each page contains 20 results. ### Request Example ``` curl -x GET "[API_URL]/affiliate-vouchers/?advertiser_id=1234&name=Name&type=code&exclusivity=1&valid=1&image=1&page=1" ``` ### Headers - **Host**: api.profitshare.ro - **X-PS-Client**: test-account - **X-PS-Accept**: json - **X-PS-Auth**: 90a6d325e982f764f86a7e248edf6a660d4ee833 ### Response #### Success Response (200) (The specific fields for voucher success response are not detailed in the provided text, but typically would include voucher code, description, validity dates, advertiser info, etc.) #### Response Example (Response example for vouchers is not provided in the input text.) ``` -------------------------------- ### Profitshare Affiliate Links Response Example Source: https://doc.profitshare.com/affiliates/docs/index This JSON structure illustrates a successful response when retrieving affiliate links. It includes a list of links, each with a name, the direct advertiser URL, and the Profitshare generated URL. ```json { "Date": "Thu, 17 Jul 2012 14:52:55 GMT", "Server": "profitshare.ro", "Content-Length": "795", "Connection": "close", "Content-Type": "text/json", "Response body": { "result":[ { "name": "test 1", "url": "http://www.advertiser1.ro/landingpage1", "ps_url": "http://profitshare.ro/l/352101" }, { "name": "test 2", "url": "http://www.advertiser2.ro/offers", "ps_url": "http://profitshare.ro/l/352102" } ] } } ``` -------------------------------- ### Filter Advertisers by ID (Sample Response) Source: https://doc.profitshare.com/affiliates/docs/index Example of a successful HTTP response when filtering advertisers. It includes metadata like Date and Content-Type, and a response body containing a list of advertisers with their details. ```json HTTP/1.1 200 OK { "Date": Thu, 17 Jul 2012 14:52:55 GMT, "Server": profitshare.ro, "Content-Length": 795, "Connection": close, "Content-Type": text/json, "Response body": { "result":[ { "id": "100", "name": "Advertiser 1", "logo": "//profitshare.ro/files_shared/advertiser-logos/logo_1.png", "category": "Fashion", "url": "http://www.xxxx.ro", "affiliate_statuses": [ "active": "yes", "approved": "yes" ] }, { "id": "104", "name": "Advertiser 2", "logo": "//profitshare.ro/files_shared/advertiser-logos/logo_2.png", "category": "Fashion", "url": "http://www.yyyyy.ro", "affiliate_statuses": [ "active": "yes", "approved": "yes" ] }, … ] } } ``` -------------------------------- ### Order Add Webhook Source: https://doc.profitshare.com/affiliates/docs/index Receives a GET request when a new order is registered. Includes order details such as reference, advertiser ID, status, date, commissions, amount, referrer page, type, and an optional hash. ```APIDOC ## Webhooks | Order Add ### Description Receives a GET request when a new order is registered. Includes order details such as reference, advertiser ID, status, date, commissions, amount, referrer page, type, and an optional hash. ### Method GET ### Endpoint [Webhook_URL] ### Parameters #### Query Parameters - **order_reference** (string) - Order number from your account - **advertiser_id** (string) - Order advertiser identifier - **status** (string) - Current Order status - it will be pending - **order_date_time** (string) - Order date and time - **commissions** (float) - Total commissions value - **amount** (float) - Total amount value - **referrer_page** (string) - Click referrer page - if it does not exist then null will be sent - **type** (string) - order_add - **hash** (string) - Optional - Order hash value - it will be sent only if exist ``` -------------------------------- ### GET /affiliate-feeds/ Source: https://doc.profitshare.com/affiliates/docs/index Retrieves a list of available feeds. The results can be filtered by status. ```APIDOC ## GET /affiliate-feeds/ ### Description Retrieves a list of available feeds. The results can be filtered by status. ### Method GET ### Endpoint [API_URL]/affiliate-feeds/ ### Query Parameters - **status** (string) - Optional - Filters feeds by their status (e.g., 'active', 'inactive'). ### Request Example ``` curl -x GET "[API_URL]/affiliate-feeds/?status=active" ``` ### Response #### Success Response (200) - **link** (string) - Direct link to the feed. - **type** (string) - Type of the feed (e.g., 'csv'). - **name** (string) - Name of the feed. - **created_at** (date) - The date and time the feed was created. - **updated_at** (date) - The date and time the feed was last updated. - **status** (string) - The status of the feed ('active' or 'inactive'). - **advertisers** (array) - A list of feed advertisers, each with 'id' and 'name'. #### Response Example ```json { "result": { "current_page": 1, "total_pages": 1, "records_per_page": 20, "feeds": [ { "link": "http://profitshare.ro/", "type": "csv", "name": "Test feed name", "created_at": "2024-07-01 00:00:00", "updated_at": "2024-07-02 03:10:20", "status": "active", "advertisers": [ { "id": 35, "name": "eMAG.ro" } ] } ] } } ``` ``` -------------------------------- ### GET /affiliate-commissions/ Source: https://doc.profitshare.com/affiliates/docs/index Retrieves a list of affiliate commissions. This endpoint supports filtering by status, date range, and click hash, as well as ordering by date and pagination. ```APIDOC ## GET /affiliate-commissions/ ### Description Retrieves a list of affiliate commissions. The results can be filtered by providing additional parameters and ordered as well. The filters will be sent via the filters parameter and the order will be sent via the order parameter. Each order has different items (products) that could be commissioned using different commission percents. Use the following fields to retrieve details about each item(separated by „|”). **Current limit:** 100 calls per 60 seconds ### Method GET ### Endpoint /affiliate-commissions/ ### Query Parameters #### Filter Parameters - **filters[status]** (string) - Optional - The status for the commission. - **filters[date_from]** (date) - Optional - For date_added >= date_from. - **filters[date_to]** (date) - Optional - For date_added <= date_to. - **filters[click_hash]** (string) - Optional - Hash used as an optional parameter on affiliate links. #### Order Parameters - **order[date]** (date) - Optional - Order by date. - **order[page]** (number) - Optional - Page number. #### Order Commission Parameters - **order[commission]** (number) - Optional - Order by commission value. ### Request Example ``` curl -x GET /affiliate-commissions/?filters[status]=pending&filters[date_from]=2013-01-15&filters[date_to]=2013-01-16 ``` ### Response #### Success Response (200) - **result** (array) - An array of commission objects. - **order_date_time** (string) - Order date and time. - **status** (string) - General status of order. - **last_update** (string) - Last update date and time. - **hash** (string) - Optional parameter used in affiliate links. - **referer_page** (string) - Click referrer page. - **click_date** (string) - Click date and time. - **recurring_time** (number) - Total seconds between click date and order date. - **id_advertiser** (number) - Unique advertiser id. - **products** (array) - Products associated with the commission. - **name** (string) - Product name. - **code** (string) - Product code. - **part_no** (string) - Product part number. - **amount** (string) - Product amount. - **commission** (string) - Commission amount for the product. - **status** (string) - Product commission status. #### Response Example ```json { "result": [ { "order_date_time": "2024-01-01 05:00:00", "status": "approved", "last_update": "2024-01-15 00:00:00", "hash": "12313sadfasc234", "referer_page": "https://google.ro/", "click_date": "2024-01-01 00:00:00", "id_advertiser": "123", "products": [ { "name": "Product name", "code": "123", "part_no": "ZXC123", "amount": "139.99", "commission": "13.99", "status": "approved" }, { "name": "Product name 2", "code": "345", "part_no": "ZXC345", "amount": "159.99", "commission": "15.99", "status": "canceled" } ] } ] } ``` ``` -------------------------------- ### Get Active Advertisers List using PHP Source: https://doc.profitshare.com/affiliates/docs/index This snippet demonstrates how to fetch a list of active advertisers from the ProfitShare API using PHP. It utilizes cURL to make an authenticated HTTP GET request, including custom headers for authentication and data format. ```php $api_user = 'api_user'; $api_key = 'api_key'; $url = 'http://api.profitshare.ro/affiliate-advertisers/?'; $query_string = ''; $spider = curl_init(); curl_setopt($spider, CURLOPT_HEADER, false); curl_setopt($spider, CURLOPT_URL, $url. $query_string); curl_setopt($spider, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($spider, CURLOPT_TIMEOUT, 30); curl_setopt($spider, CURLOPT_RETURNTRANSFER, true); curl_setopt($spider, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($spider, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'); $profitshare_login = array( 'api_user' => $api_user, 'api_key' => $api_key, ); $date = gmdate('D, d M Y H:i:s T', time()); $signature_string = 'GETaffiliate-advertisers/?' . $query_string . '/' . $profitshare_login['api_user'] . $date; $auth = hash_hmac('sha1', $signature_string, $profitshare_login['api_key']); $extra_headers = array( "Date: {$date}", "X-PS-Client: {$profitshare_login['api_user']}", "X-PS-Accept: json", "X-PS-Auth: {$auth}" ); curl_setopt($spider, CURLOPT_HTTPHEADER, $extra_headers); $output = curl_exec($spider); curl_close($spider); echo $output; ``` -------------------------------- ### GET /affiliate-feeds Source: https://doc.profitshare.com/affiliates/docs/index Retrieves a list of all available product feeds from your affiliate account. This endpoint is useful for discovering products you can promote. ```APIDOC ## GET /affiliate-feeds ### Description Lists all available product feeds from the affiliate account. ### Method GET ### Endpoint [API_URL]/affiliate-feeds/ ### Example Link ```bash curl -x GET "[API_URL]/affiliate-feeds" ``` ### Headers - **Host** (string) - api.profitshare.ro - **X-PS-Client** (string) - test-account - **X-PS-Accept** (string) - json - **X-PS-Auth** (string) - 90a6d325e982f764f86a7e248edf6a660d4ee833 ### Header Sample Request ``` 'Host:api.profitshare.ro' 'X-PS-Client:test-account' 'X-PS-Accept:json' 'X-PS-Auth:90a6d325e982f764f86a7e248edf6a660d4ee833' ``` ### Query Parameters - **page** (number) - Optional. The results are paginated, each page having 20 results. In order to get page N, provide number for N. ### Response #### Success Response (200) - **result** (object) - Contains the list of available feeds. - **current_page** (number) - The current page number of the results. - **total_pages** (number) - The total number of pages available. - **records_per_page** (number) - The number of records displayed per page. - **commissions** (array) - A list of commission details. - **order_id** (number) - Unique order identifier (profitshare). - **order_ref** (number) - Unique order identifier (advertiser). - **order_status** (string) - General status of the order (pending, approved, canceled). - **advertiser_id** (number) - Unique advertiser ID. - **hash** (string) - Optional parameter used in affiliate links. - **order_date** (date) - Order date and time. - **order_updated** (date) - Last update date and time. - **items_status** (string) - Status of each order item separated by '|'. - **items_commision** (number) - Value of each order item commission, in RON without VAT. - **items_commision_value** (string) - Value of each order item commission percent. - **network_reference** (string) - Network tracking reference. #### Response Example ```json { "result": { "current_page": 1, "total_pages": 2, "records_per_page": 25, "commissions": [ { "order_id": 3000099327, "order_ref": "8657110", "order_status": "pending", "advertiser_id": 35, "hash": "your_refference", "order_date": "2013-11-01 14:20:37", "order_updated": "0000-00-00 00:00:00", "items_status": "pending|pending", "items_commision": "4.5965|56.3707", "items_commision_value": "3.00|3.00", "network_reference": "Cj0KCQjw2cWgBhDYARIsALggUNqtfnj5q8aAumnEALw_aS" }, { "order_id": 3000099323, "order_ref": "45699", "order_status": "pending", "advertiser_id": 35, "hash": "your_refference", "order_date": "2013-11-01 13:53:00", "order_updated": "0000-00-00 00:00:00", "items_status": "pending", "items_commision": "5.4031", "items_commision_value": "1.00", "network_reference": "Cj0KCQjw2cWgBhDYARIsALggUNqtfnj5q8aAumnEALw_aS" } ] } } ``` ``` -------------------------------- ### GET /websites/doc_profitshare_affiliates Source: https://doc.profitshare.com/affiliates/docs/index Retrieves a list of vouchers based on specified query parameters. Supports filtering by advertiser, name, exclusivity, type, validity, image presence, and pagination. ```APIDOC ## GET /websites/doc_profitshare_affiliates ### Description Retrieves a list of vouchers based on specified query parameters. Supports filtering by advertiser, name, exclusivity, type, validity, image presence, and pagination. ### Method GET ### Endpoint /websites/doc_profitshare_affiliates ### Parameters #### Query Parameters - **advertiser_id** (integer) - Optional - advertiser ID - **name** (string) - Optional - voucher name - **exclusivity** (boolean) - Optional - vouchers assigned to you (value : 1) or common (value : 0). Ex: exclusivity=1 - **type** (string) - Optional - type of the voucher (code,promotion). Ex: type=code Default value: `code,promotion` - **valid** (boolean) - Optional - for all vouchers (ex: valid=0) or active ones (ex: valid=1) - **image** (boolean) - Optional - vouchers with banner (ex: image=1) or all vouchers (ex: image=0) - **page** (number) - Optional - The results are paginated, each page having 20 results. In order to get page N, provide number for N ### Response #### Success Response (200) - **adv_name** (string) - advertiser name - **name** (string) - name of voucher - **type** (number) - voucher type - **code** (string) - voucher code - **discount** (string) - discount value - **valability** (string) - active period - **adv_logo** (string) - advertiser logo - **tracking_link** (string) - tracking link - **image** (string) - voucher image #### Response Example ```json { "result": { "current_page": 1, "total_pages": 1, "records_per_page": 20, "results": [ { "adv_name": "eMAG.ro", "name": "sdsdsf", "type": "code", "code": "32131", "discount": "45 %", "valability": "2024-06-20 - 2024-07-15", "exclusivity": 0, "adv_logo": "logo_adv_1351266509.png", "tracking_link": "http://profitshare.ro/l/352101", "image": "voucher_image_23423432ew.png" } ] } } ``` ``` -------------------------------- ### Order Add Webhook Request Source: https://doc.profitshare.com/affiliates/docs/index This describes the GET request made when a new order is registered. It includes parameters such as order reference, advertiser ID, status, order date/time, commissions, amount, referrer page, type, and an optional order hash. ```HTTP GET [Webhook_URL]?order_reference=12345&advertiser_id=678&status=pending&order_date_time=2024-07-15T10:00:00Z&commissions=10.50&amount=100.00&referrer_page=http://example.com/click&type=order_add&hash=abcdef12345 ``` -------------------------------- ### Profitshare API Success Response Example Source: https://doc.profitshare.com/affiliates/docs/index This JSON structure represents a successful response from the Profitshare API, detailing order information such as IDs, status, advertiser details, and commission values. It includes pagination information and a list of commissions. ```json { "Date": "Tue, 17 Jul 2012 14:55:35 GMT", "Server": "Profitshare", "Content-Length": "795", "Connection": "close", "Content-Type": "text/json", "result": { "current_page": 1, "total_pages": 2, "records_per_page": 25, "commissions": [ { "order_id": 3000099327, "order_ref": "8657110", "order_status": "pending", "advertiser_id": 35, "hash": "your_refference", "order_date": "2013-11-01 14:20:37", "order_updated": "0000-00-00 00:00:00", "items_status": "pending|pending", "items_commision": "4.5965|56.3707", "items_commision_value": "3.00|3.00", "network_reference": "Cj0KCQjw2cWgBhDYARIsALggUNqtfnj5q8aAumnEALw_aS" }, { "order_id": 3000099323, "order_ref": "45699", "order_status": "pending", "advertiser_id": 35, "hash": "your_refference", "order_date": "2013-11-01 13:53:00", "order_updated": "0000-00-00 00:00:00", "items_status": "pending", "items_commision": "5.4031", "items_commision_value": "1.00", "network_reference": "Cj0KCQjw2cWgBhDYARIsALggUNqtfnj5q8aAumnEALw_aS" } ] } } } ``` -------------------------------- ### Get Affiliate Campaigns Endpoint Source: https://doc.profitshare.com/affiliates/docs/index This endpoint retrieves a paginated list of affiliate campaigns. The API supports flash files (.swf) and requires proper HTML tags for integration. A rate limit of 60 calls per 60 seconds is enforced. ```http GET [API_URL]/affiliate-campaigns/ ``` -------------------------------- ### Get Advertiser Products using PHP Source: https://doc.profitshare.com/affiliates/docs/index This snippet shows how to retrieve a list of products for a specific advertiser from the ProfitShare API using PHP. It constructs a cURL request with authentication headers and query parameters to filter products by advertiser ID. ```php $api_user = 'xxx'; $api_key = 'xxx'; $url = 'http://api.profitshare.ro/affiliate-products/?'; $query_string = 'page=1&filters[advertiser]=57323'; $spider = curl_init(); curl_setopt($spider, CURLOPT_HEADER, false); curl_setopt($spider, CURLOPT_URL, $url. $query_string); curl_setopt($spider, CURLOPT_CONNECTTIMEOUT, 60); curl_setopt($spider, CURLOPT_TIMEOUT, 30); curl_setopt($spider, CURLOPT_RETURNTRANSFER, true); curl_setopt($spider, CURLOPT_HTTPAUTH, CURLAUTH_ANY); curl_setopt($spider, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)'); $profitshare_login = array( 'api_user' => $api_user, 'api_key' => $api_key, ); $date = gmdate('D, d M Y H:i:s T', time()); $signature_string = 'GETaffiliate-products/?' . $query_string . '/' . $profitshare_login['api_user'] . $date; $auth = hash_hmac('sha1', $signature_string, $profitshare_login['api_key']); $extra_headers = array( "Date: {$date}", "X-PS-Client: {$profitshare_login['api_user']}", "X-PS-Accept: json", "X-PS-Auth: {$auth}" ); curl_setopt($spider, CURLOPT_HTTPHEADER, $extra_headers); $output = curl_exec($spider); curl_close($spider); echo $output; ``` -------------------------------- ### Order Update Webhook Source: https://doc.profitshare.com/affiliates/docs/index Receives a GET request when an order is updated. Includes optional order details such as reference, advertiser ID, status, date, commissions, amount, referrer page, type, and hash. ```APIDOC ## Webhooks | Order Update ### Description Receives a GET request when an order is updated. Includes optional order details such as reference, advertiser ID, status, date, commissions, amount, referrer page, type, and hash. ### Method GET ### Endpoint [Webhook_URL] ### Parameters #### Query Parameters - **order_reference** (string) - Optional - Order number from your account - **advertiser_id** (string) - Optional - Order advertiser identifier - **status** (string) - Optional - Current Order status - it will be pending - **order_date_time** (string) - Optional - Order date and time - **commissions** (float) - Optional - Total commissions value - **amount** (float) - Optional - Total amount value - **referrer_page** (string) - Optional - Click referrer page - if it does not exist then null will be sent - **type** (string) - Optional - order_add - **hash** (string) - Optional - Order hash value - it will be sent only if exist ``` -------------------------------- ### Order Update Webhook Request Source: https://doc.profitshare.com/affiliates/docs/index This describes the GET request made when an order is changed. It includes optional parameters such as order reference, advertiser ID, status, order date/time, commissions, amount, referrer page, type, and an optional order hash. ```HTTP GET [Webhook_URL]?order_reference=12345&advertiser_id=678&status=completed&order_date_time=2024-07-15T11:00:00Z&commissions=12.00&amount=120.00&referrer_page=http://example.com/click&type=order_update&hash=abcdef12345 ``` -------------------------------- ### API Request Header Sample Source: https://doc.profitshare.com/affiliates/docs/index A sample of the HTTP headers required for making requests to the Profitshare API. This includes Host, Date, X-PS-Accept, and X-PS-Auth. ```http 'Host:api.profitshare.ro' 'Date:Thu, 17 Jul 2012 14:52:54 GMT' 'X-PS-Accept:json' 'X-PS-Auth:90a6d325e982f764f86a7e248edf6a660d4ee833' ``` -------------------------------- ### Affiliate Campaigns Listing (Sample Response) Source: https://doc.profitshare.com/affiliates/docs/index Sample JSON response for the affiliate campaigns endpoint. It includes pagination details and a list of campaigns, each with its ID, name, commission type, dates, URL, and available banners. ```json HTTP/1.1 200 OK { "Date": Thu, 17 Jul 2012 14:52:55 GMT, "Server": profitshare.ro, "Content-Length": 795, "Connection": close, "Content-Type": text/json, "Response body": { "result":{ "paginator":{ "itemsPerPage":20, "currentPage":2, "totalPages":2 }, "campaigns":[ { "id":118, "name":"Carti la eMAG", "commissionType":"CPS", "startDate":"2013-05-13 00:00:00", "endDate":"2013-12-31 00:00:00", "url":"http://www.emag.ro/carti/l/", "banners":{ "468x60":{ "width":468, "height":60, "src":"//profitshare.ro/images/advertiser_widgets/a.jpg" }, "125x125":{ "width":125, "height":125, "src":"//profitshare.ro/images/advertiser_widgets/s.swf" } }, … } ] } } } ``` -------------------------------- ### Authenticate Profitshare API with PHP Source: https://doc.profitshare.com/affiliates/docs/index This snippet demonstrates how to generate the necessary headers for authenticating with the Profitshare API using PHP. It includes generating the Date header and the X-PS-Auth signature using HMAC-SHA1. ```php $date = gmdate('D, d M Y H:i:s T', time()); $signature_string = "$request_type$route" . $query_string .'/'. PS_API_USER . $date; $auth = hash_hmac('sha1', $signature_string, PS_API_KEY); $extra_headers = array( "Date: {$date}", "X-PS-Client: " . PS_API_USER, "X-PS-Accept: json", "X-PS-Auth: {$auth}" ); curl_setopt($curl, CURLOPT_HTTPHEADER, $extra_headers); ``` -------------------------------- ### Get Commission Details Endpoint Source: https://doc.profitshare.com/affiliates/docs/index This endpoint allows filtering commission details by order number. It has a rate limit of 60 calls per 60 seconds. ```http get [API_URL]/affiliate-commissions-details/ ``` -------------------------------- ### POST /affiliate-links Source: https://doc.profitshare.com/affiliates/docs/index This endpoint allows you to create new affiliate links. You can provide a name and a direct URL to an advertiser's page, and the API will generate a trackable Profitshare link. ```APIDOC ## POST /affiliate-links ### Description Creates new affiliate links with optional reporting parameters. ### Method POST ### Endpoint [API_URL]/affiliate-links/ ### Headers - **Host** (string) - Url Api - **Date** (date) - Date - **X-PS-Client** (string) - Client - **X-PS-Accept** (string) - Json Content - **X-PS-Auth** (string) - Auth Token ### Header Sample Request ``` 'Host:api.profitshare.ro' 'Date:Thu, 17 Jul 2012 14:52:54 GMT' 'X-PS-Client:test-account' 'X-PS-Accept:json' 'X-PS-Auth:90a6d325e982f764f86a7e248edf6a660d4ee833' ``` ### Query Parameters - **Important** (array) - Array of links with the following values: - **name** (string) - Link url name - **url** (string) - Direct url to advertiser ### Response #### Success Response (200) - **result** (array) - An array of generated affiliate links. - **name** (string) - The name of the affiliate link. - **url** (string) - The original advertiser URL. - **ps_url** (string) - The generated Profitshare affiliate link. #### Response Example ```json { "Date": "Thu, 17 Jul 2012 14:52:55 GMT", "Server": "profitshare.ro", "Content-Length": 795, "Connection": "close", "Content-Type": "text/json", "Response body": { "result":[ { "name": "test 1", "url": "http://www.advertiser1.ro/landingpage1", "ps_url": "http://profitshare.ro/l/352101" }, { "name": "test 2", "url": "http://www.advertiser2.ro/offers", "ps_url": "http://profitshare.ro/l/352102" } ] } } ``` ``` -------------------------------- ### Success Response for Affiliate Vouchers Source: https://doc.profitshare.com/affiliates/docs/index This is a sample success response for a voucher query. It includes pagination details and a list of voucher results, each containing advertiser name, voucher name, type, code, discount, validity period, exclusivity, advertiser logo, tracking link, and image. ```JSON { "result": { "current_page": 1, "total_pages": 1, "records_per_page": 20, "results": [ { "adv_name": "eMAG.ro", "name": "sdsdsf", "type": "code", "code": "32131", "discount": "45 %", "valability": "2024-06-20 - 2024-07-15", "exclusivity": 0, "adv_logo": "logo_adv_1351266509.png", "tracking_link": "http://profitshare.ro/l/352101", "image": "voucher_image_23423432ew.png" }, ... ] } } ``` -------------------------------- ### Query Affiliate Vouchers Source: https://doc.profitshare.com/affiliates/docs/index This section details the query parameters available for retrieving affiliate vouchers. It specifies optional fields such as advertiser ID, voucher name, exclusivity, type, validity, image inclusion, and pagination. ```HTTP GET /vouchers?advertiser_id=123&name=SummerSale&exclusivity=1&type=code&valid=1&image=1&page=2 ``` -------------------------------- ### API Request Headers Source: https://doc.profitshare.com/affiliates/docs/index Standard headers required for API requests. These include the Host, Date, X-PS-Client, X-PS-Accept, and X-PS-Auth token for authentication and content negotiation. ```http 'Host:api.profitshare.ro' 'Date:Thu, 17 Jul 2012 14:52:54 GMT' 'X-PS-Client:test-account' 'X-PS-Accept:json' 'X-PS-Auth:90a6d325e982f764f86a7e248edf6a660d4ee833' ```