Difference between revisions of "NATS5 REST API Adtool GET type"
From TMM Wiki
Jump to navigationJump to search(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{NATS5 Manual |
− | | | + | | show_api_admin_adtool_section = true |
}} | }} | ||
== '''GET /adtool/type''' == | == '''GET /adtool/type''' == | ||
+ | |||
'''Description''' | '''Description''' | ||
* Get details of adtool type | * Get details of adtool type | ||
Line 9: | Line 10: | ||
*Replace domain with the nats domain | *Replace domain with the nats domain | ||
− | '''[[ | + | '''[[NATS5_REST_API_Overview#Allowed_HTTP_Request_Methods|Request Method''']] |
*GET | *GET | ||
'''Response Format''' | '''Response Format''' | ||
*JSON | *JSON | ||
− | '''[[ | + | '''[[NATS5_REST_API_Overview#Authentication|Authentication]]''' |
*HTTP headers | *HTTP headers | ||
Line 25: | Line 26: | ||
** required | ** required | ||
* '''deleted''' | * '''deleted''' | ||
− | ** type: boolean_digit | + | ** type: boolean_digit (0 or 1) |
** optional | ** optional | ||
* '''return_fields''' | * '''return_fields''' | ||
− | ** type: boolean_digit | + | ** type: boolean_digit (0 or 1) |
** optional (default value: 1) | ** optional (default value: 1) | ||
Line 34: | Line 35: | ||
Method: '''GET'''<br/> | Method: '''GET'''<br/> | ||
URL: <nowiki>http://domain/api/adtool/type</nowiki><br/> | URL: <nowiki>http://domain/api/adtool/type</nowiki><br/> | ||
− | Query String: <nowiki>adtool_type_id=4</nowiki><br/> | + | Query String: <nowiki>adtool_type_id=4&deleted=1&return_fields=1</nowiki><br/> |
Response: | Response: | ||
Line 224: | Line 225: | ||
$data = Array( | $data = Array( | ||
'adtool_type_id' => 4, | 'adtool_type_id' => 4, | ||
+ | 'deleted' => 1, | ||
+ | 'return_fields' => 1, | ||
); | ); | ||
Line 265: | Line 268: | ||
</pre> | </pre> | ||
− | [[Category: | + | [[Category:NATS5_REST_APIs]] |
− | [[Category: | + | [[Category:NATS5_REST_adtool_Collection]] |
[[Category:Autogenerated_Wiki_Article]]<!-- Remove this tag when customizing a wiki article. The article will no longer be automatically updated --> | [[Category:Autogenerated_Wiki_Article]]<!-- Remove this tag when customizing a wiki article. The article will no longer be automatically updated --> | ||
[[Category:Autogenerated_Rest_Sample]]<!-- This article has a generated REST API Sample from our unit testing system. Also remove if customizing the wiki article --> | [[Category:Autogenerated_Rest_Sample]]<!-- This article has a generated REST API Sample from our unit testing system. Also remove if customizing the wiki article --> |
Latest revision as of 16:57, 9 August 2019
GET /adtool/type
Description
- Get details of adtool type
Resource URL
- http://domain/api/adtool/type
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Parameters can be sent as url encoded params
- adtool_type_id
- type: digit
- required
- deleted
- type: boolean_digit (0 or 1)
- optional
- return_fields
- type: boolean_digit (0 or 1)
- optional (default value: 1)
Example Request
Method: GET
URL: http://domain/api/adtool/type
Query String: adtool_type_id=4&deleted=1&return_fields=1
Response:
{ "success": true, "adtool_type": { "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, "types": { "db_field": "type", "options": { "1": "Pictures", "2": "Videos", "3": "Mixed" } }, "fields": [ { "adtool_field_id": "21", "adtool_type_id": "4", "shortname": "name", "name": "Name", "type": "0", "required": "1", "min": "1", "max": "128", "orderid": "1", "min_display": "1", "allow_search": "1", "is_unique": "1", "protection": "2", "check_function": "", "deleted": "0", "type_nice": "Text Field", "allow_search_nice": "Text" }, { "adtool_field_id": "22", "adtool_type_id": "4", "shortname": "content_zip", "name": "Content Zip", "type": "3", "required": "1", "min": "0", "max": "0", "orderid": "2", "min_display": "0", "allow_search": "0", "is_unique": "0", "protection": "2", "check_function": "", "deleted": "0", "type_nice": "Zip Upload", "allow_search_nice": "No" }, { "adtool_field_id": "23", "adtool_type_id": "4", "shortname": "type", "name": "Type", "type": "1", "required": "1", "min": "0", "max": "0", "orderid": "3", "min_display": "1", "allow_search": "2", "is_unique": "0", "protection": "2", "check_function": "", "deleted": "0", "type_nice": "Multiple Choice", "allow_search_nice": "Text", "mc_options": [ { "id": 1, "option": "Pictures", "deleted": "0" }, { "id": 2, "option": "Videos", "deleted": "0" }, { "id": 3, "option": "Mixed", "deleted": "0" } ], "mc_options_deleted": { "1": "0", "2": "0", "3": "0" } }, { "adtool_field_id": "24", "adtool_type_id": "4", "shortname": "thumbnail", "name": "Thumbnail", "type": "106", "required": "0", "min": "0", "max": "0", "orderid": "4", "min_display": "0", "allow_search": "0", "is_unique": "0", "protection": "2", "check_function": "content_zip", "deleted": "0", "type_nice": "Thumbnail", "allow_search_nice": "No", "ext": "thumb_ext" }, { "adtool_field_id": "25", "adtool_type_id": "4", "shortname": "zip_size", "name": "File Size", "type": "102", "required": "0", "min": "0", "max": "0", "orderid": "5", "min_display": "0", "allow_search": "0", "is_unique": "0", "protection": "2", "check_function": "content_zip", "deleted": "0", "type_nice": "File Size", "allow_search_nice": "No" }, { "adtool_field_id": "26", "adtool_type_id": "4", "shortname": "thumb_ext", "name": "Thumb Ext", "type": "103", "required": "0", "min": "0", "max": "0", "orderid": "6", "min_display": "0", "allow_search": "0", "is_unique": "0", "protection": "2", "check_function": "thumbnail", "deleted": "0", "type_nice": "Extension", "allow_search_nice": "No" } ], "adtool_category": "Content" } }
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( 'adtool_type_id' => 4, 'deleted' => 1, 'return_fields' => 1, ); $request = Array( 'method' => 'GET', 'path' => 'v1/adtool/type', '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); ?>