NATS5 REST API Adtool GET types
From TMM Wiki
Jump to navigationJump to searchGET /adtool/types
Note: This is an autogenerated wiki page for the NATS5 API. There may be additional descriptions or examples available on the NATS 4 API wiki for this API.
Description
- Get types of adtools
Resource URL
- http://domain/api/adtool/types
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Parameters can be sent as url encoded params
- adtool_category_id
- type: digit
- optional
- order
- type: string
- optional
- deleted
- type: boolean_digit (0 or 1)
- optional
Example Request
Method: GET
URL: http://domain/api/adtool/types
Response:
[ { "adtool_type_id": "1", "name": "Image Banners", "adtool_category_id": "1", "description": "Image Banners", "orderid": "1", "deleted": "0", "switch_db_field": "round((width\/height)*10)", "disp_tpl": "banner", "form_tpl": "banner", "protection": "2", "bulk": "1", "zip_type": "1", "short": "image_banners", "adtool_count": 0 }, { "adtool_type_id": "2", "name": "FHG", "adtool_category_id": "2", "description": "Free Hosted Galleries", "orderid": "2", "deleted": "0", "switch_db_field": "type", "disp_tpl": "fhg", "form_tpl": "fhg", "protection": "2", "bulk": "3", "zip_type": "0", "short": "fhg", "adtool_count": 0 }, { "adtool_type_id": "3", "name": "Page Ads", "adtool_category_id": "6", "description": "Half Page \/ Full Page Ads", "orderid": "3", "deleted": "0", "switch_db_field": "type", "disp_tpl": "page", "form_tpl": "page", "protection": "2", "bulk": "0", "zip_type": "4", "short": "page_ads", "adtool_count": 0 }, { "adtool_type_id": "4", "name": "Content", "adtool_category_id": "3", "description": "Content Zips", "orderid": "5", "deleted": "0", "switch_db_field": "type", "disp_tpl": "content", "form_tpl": "content", "protection": "2", "bulk": "3", "zip_type": "2", "short": "content", "adtool_count": 0 }, { "adtool_type_id": "5", "name": "Feeds", "adtool_category_id": "3", "description": "Feeds", "orderid": "4", "deleted": "0", "switch_db_field": "type", "disp_tpl": "feeds", "form_tpl": "feeds", "protection": "2", "bulk": "3", "zip_type": "0", "short": "feeds", "adtool_count": 0 }, { "adtool_type_id": "6", "name": "Mailers", "adtool_category_id": "3", "description": "Mailing Ads", "orderid": "6", "deleted": "0", "switch_db_field": "type", "disp_tpl": "page", "form_tpl": "page", "protection": "2", "bulk": "0", "zip_type": "4", "short": "mailers", "adtool_count": 0 }, { "adtool_type_id": "7", "name": "Page Peels", "adtool_category_id": "5", "description": "Page Peel Ads", "orderid": "7", "deleted": "0", "switch_db_field": "type", "disp_tpl": "peel", "form_tpl": "peel", "protection": "2", "bulk": "0", "zip_type": "3", "short": "page_peels", "adtool_count": 0 }, { "adtool_type_id": "8", "name": "Geo Banners", "adtool_category_id": "1", "description": "Geo Targeted Banners", "orderid": "9", "deleted": "0", "switch_db_field": "round((width\/height)*10)", "disp_tpl": "textimg", "form_tpl": "textimg", "protection": "2", "bulk": "1", "zip_type": "0", "short": "geo_banners", "adtool_count": 0 }, { "adtool_type_id": "9", "name": "Flash Banners", "adtool_category_id": "1", "description": "Flash Banners", "orderid": "8", "deleted": "0", "switch_db_field": "round((width\/height)*10)", "disp_tpl": "banner", "form_tpl": "banner", "protection": "2", "bulk": "1", "zip_type": "1", "short": "flash_banners", "adtool_count": 0 }, { "adtool_type_id": "11", "name": "Fan Signs", "adtool_category_id": "3", "description": "Custom Fan Signs", "orderid": "11", "deleted": "0", "switch_db_field": "", "disp_tpl": "textimg", "form_tpl": "textimg", "protection": "2", "bulk": "0", "zip_type": "0", "short": "fan_signs", "adtool_count": 0 }, { "adtool_type_id": "12", "name": "Video Download", "adtool_category_id": "3", "description": "Downloadable Videos", "orderid": "12", "deleted": "0", "switch_db_field": "type", "disp_tpl": "video", "form_tpl": "video", "protection": "2", "bulk": "3", "zip_type": "0", "short": "video_download", "adtool_count": 0 }, { "adtool_type_id": "14", "name": "HFS", "adtool_category_id": "6", "description": "Free Sites", "orderid": "14", "deleted": "0", "switch_db_field": "type", "disp_tpl": "fhg", "form_tpl": "fhg", "protection": "2", "bulk": "3", "zip_type": "0", "short": "hfs", "adtool_count": 0 }, { "adtool_type_id": "18", "name": "IM Popups", "adtool_category_id": "5", "description": "IM Popups", "orderid": "18", "deleted": "0", "switch_db_field": "", "disp_tpl": "interactive", "form_tpl": "interactive", "protection": "2", "bulk": "0", "zip_type": "5", "short": "im_popups", "adtool_count": 0 }, { "adtool_type_id": "19", "name": "Footer Ads", "adtool_category_id": "5", "description": "Footer Ads", "orderid": "19", "deleted": "0", "switch_db_field": "", "disp_tpl": "interactive", "form_tpl": "interactive", "protection": "2", "bulk": "0", "zip_type": "6", "short": "footer_ads", "adtool_count": 0 }, { "adtool_type_id": "21", "name": "Overlays", "adtool_category_id": "6", "description": "Page Overlay Ads", "orderid": "21", "deleted": "0", "switch_db_field": "", "disp_tpl": "interactive", "form_tpl": "interactive", "protection": "2", "bulk": "0", "zip_type": "7", "short": "overlays", "adtool_count": 0 }, { "adtool_type_id": "22", "name": "Video Hosted", "adtool_category_id": "3", "description": "Hosted Videos", "orderid": "14", "deleted": "0", "switch_db_field": "type", "disp_tpl": "video", "form_tpl": "video", "protection": "2", "bulk": "3", "zip_type": "0", "short": "video_hosted", "adtool_count": 0 }, { "adtool_type_id": "23", "name": "Video Embed", "adtool_category_id": "3", "description": "Embedded Videos", "orderid": "13", "deleted": "0", "switch_db_field": "type", "disp_tpl": "embeds", "form_tpl": "embeds", "protection": "2", "bulk": "3", "zip_type": "0", "short": "video_embed", "adtool_count": 0 }, { "adtool_type_id": "104", "name": "Rotating I-Frame", "adtool_category_id": "103", "description": "Rotating Adtool iFrame", "orderid": "104", "deleted": "0", "switch_db_field": "type", "disp_tpl": "rotating", "form_tpl": "rotating", "protection": "0", "bulk": "0", "zip_type": "0", "short": "rotating_i_frame", "adtool_count": 0 } ]
Example Code
PHP
<?php $headers = array( //set your username and API key here 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: tmm1phrvezsbu' ); $url = 'http://yourdomain.com'; //set your NATS URL here $data = array( // Add API parameters here ); $request = Array( 'method' => 'GET', 'path' => 'v1/adtool/types', 'data' => $data ); /*code below is the same for (almost) every API call */ $curl = curl_init(); $url = $url.'/api/'.$request['path']; $query = http_build_query($request['data']); if($request['method'] == 'GET'){ //add query string parameters to the end of the url $url = $url.'?'.$query; }else{ //send parameters as POST fields curl_setopt($curl, CURLOPT_POST, 1); curl_setopt($curl, CURLOPT_POSTFIELDS, $query); if($request['method'] != 'POST'){ $headers[] ='X-HTTP-Method: '.$request['method']; //send custom request method } } curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $resp = curl_exec($curl); //dumps an associative array representation of the json var_dump(json_decode($resp, true)); // Close request to clear up some resources curl_close($curl); ?>