Difference between revisions of "NATS4 REST API Admin Get Adtools"
From TMM Wiki
Jump to navigationJump to search (Created page with "{{NATS4 Manual | show_api_admin_section = true }} == '''GET adtools/types''' == '''Description''' *This resource allows you to get a list of available adtool types. '''Res...") |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
| show_api_admin_section = true | | show_api_admin_section = true | ||
}} | }} | ||
− | == '''GET adtools/ | + | == '''GET adtools/admin''' == |
'''Description''' | '''Description''' | ||
− | *This resource allows | + | *This resource allows adtool functions on your site. |
'''Resource URL''' | '''Resource URL''' | ||
− | *<nowiki>http://domain/api | + | *<nowiki>http://domain/api/adtools/admin</nowiki> |
*Replace domain with the nats domain | *Replace domain with the nats domain | ||
Line 23: | Line 23: | ||
'''''Paremeters can be sent as url encoded params or as part of the HTTP request body''.''' | '''''Paremeters can be sent as url encoded params or as part of the HTTP request body''.''' | ||
− | *'''typeid''': ''The adtool type to get adtools for (see the ([[ | + | *'''typeid''': ''The adtool type to get adtools for (see the ([[NATS4_REST_API_Adtool_Types|GET adtools/types resource]])'' |
**'''''type: string''''' | **'''''type: string''''' | ||
**'''''required''''' | **'''''required''''' | ||
Line 36: | Line 36: | ||
*'''options''': ''A serialized array of parameters. See [[Nats_display_adtools|nats_display_adtools]] for the available parameters (you can use category, typeid, start, count, order, searchinline, and the search fields)'' | *'''options''': ''A serialized array of parameters. See [[Nats_display_adtools|nats_display_adtools]] for the available parameters (you can use category, typeid, start, count, order, searchinline, and the search fields)'' | ||
− | **'''''type: Serialized Array''''' | + | **'''''type: PHP Serialized Array''''' |
**'''''optional''''' | **'''''optional''''' | ||
− | |||
== '''Example Request''' == | == '''Example Request''' == | ||
Line 44: | Line 43: | ||
'''GET''' | '''GET''' | ||
− | <nowiki>http://domain/api | + | <nowiki>http://domain/api/adtools/admin</nowiki> |
*Response: | *Response: | ||
Line 105: | Line 104: | ||
$data_string = http_build_query($data); | $data_string = http_build_query($data); | ||
− | $url = 'http://domain/api | + | $url = 'http://domain/api/adtools/admin?'.$data_string; |
$headers = array( | $headers = array( | ||
− | ' | + | 'api-key: 44b5498dbcb481a0d00b404c0169af62', |
− | ' | + | 'api-username: tmm1phrvezsbu' |
); | ); | ||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); | curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); |
Latest revision as of 19:26, 26 March 2015
GET adtools/admin
Description
- This resource allows adtool functions on your site.
Resource URL
- http://domain/api/adtools/admin
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Paremeters can be sent as url encoded params or as part of the HTTP request body.
- typeid: The adtool type to get adtools for (see the (GET adtools/types resource)
- type: string
- required
- natscode: Input your NATS code here. This specifies the loginid, campaignid, programid, siteid, and tourid used for the adtool. This is used when deciding what adtools are available, as well as what link code to use. You can build your own NATS code using an unencoded structure - please refer to this article about Unencoded Link Codes.
- type: string
- optional
- siteid: This gives you the option to override the siteid that already exists in the NATS code. This parameter is optional; if you do not want to override your siteid, input 0 to disable it.
- type: string
- optional
- options: A serialized array of parameters. See nats_display_adtools for the available parameters (you can use category, typeid, start, count, order, searchinline, and the search fields)
- type: PHP Serialized Array
- optional
Example Request
GET
http://domain/api/adtools/admin
- Response:
[ { "adtoolid": "216", "name": "asdf", "url": "asdf", "date_added": null, "published_date": "1417496400", "trackrl": "http:\/\/domain\/gallery\/MC44LjEuMy4wLjIxNi4wLjAuMA", "natscode": "MS44LjEuMy4wLjIxNi4wLjAuMA", "extra": { "identid": "4", "siteid": "0", "networkid": "0", "type": "1", "items": "0", "description": "", "thumbnail": "", "thumb_ext": "", "deleted": "0", "model": "", "ids": { "loginid": "1", "programid": "8", "siteid": "1", "siteids": [ "1", "2", "3", "4" ] }, "var_divide": "?" } } ]
Example Code
PHP
<?php $curl = curl_init(); $options = array( 'searchinline' => 1, 'search_type' => '5:1' ); $data = array( 'natscode' => 'tmm1phrvezsbu.8.1.3.0.0.0.0.0', 'typeid' => '1', 'siteid' => 1, 'options' => serialize($options) ); $data_string = http_build_query($data); $url = 'http://domain/api/adtools/admin?'.$data_string; $headers = array( 'api-key: 44b5498dbcb481a0d00b404c0169af62', 'api-username: tmm1phrvezsbu' ); curl_setopt($curl, CURLOPT_HTTPHEADER, $headers); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_URL, $url); $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); ?>