NATS5 REST API Affiliate GET payvia-type
From TMM Wiki
Jump to navigationJump to searchGET /affiliate/payvia-type
Description
- Get payvia type information for an affiliate
Resource URL
- http://domain/api/affiliate/payvia-type
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Parameters can be sent as url encoded params
- loginid
- type: digit
- required
- payvia_type_id
- type: digit
- required
Example Request
Method: GET
URL: http://domain/api/affiliate/payvia-type
Query String: loginid=3&payvia_type_id=1
Response:
{ "success": true, "payvia_type": { "payvia_type_id": "1", "name": "Check", "description": "Check By Mail", "dumpid": "8", "minimum": [ "50", "100", "250", "500", "1000", "2500" ], "enabled": "1", "cost": "0", "protection": "1", "deleted": "0", "dump_name": "Check Default", "lang_name": "Check", "cost_nice": "$0.00", "cost_dec": "0.00", "form": [ { "payvia_field_id": "1", "payvia_type_id": "1", "name": "Pay To", "type": "0", "required": "1", "min": "1", "max": "64", "orderid": "1", "is_unique": "1", "protection": "0", "check_function": "", "deleted": "0", "payvia_hash": "1", "value": "" }, { "payvia_field_id": "30", "payvia_type_id": "1", "name": "Address", "type": "0", "required": "0", "min": "0", "max": "255", "orderid": "2", "is_unique": "0", "protection": "0", "check_function": "", "deleted": "0", "payvia_hash": "0", "value": "" }, { "payvia_field_id": "31", "payvia_type_id": "1", "name": "Address 2", "type": "0", "required": "0", "min": "0", "max": "255", "orderid": "3", "is_unique": "0", "protection": "0", "check_function": "", "deleted": "0", "payvia_hash": "0", "value": "" }, { "payvia_field_id": "32", "payvia_type_id": "1", "name": "City", "type": "0", "required": "0", "min": "0", "max": "128", "orderid": "4", "is_unique": "0", "protection": "0", "check_function": "", "deleted": "0", "payvia_hash": "0", "value": "" }, { "payvia_field_id": "33", "payvia_type_id": "1", "name": "State", "type": "0", "required": "0", "min": "0", "max": "128", "orderid": "5", "is_unique": "0", "protection": "0", "check_function": "", "deleted": "0", "payvia_hash": "0", "value": "" }, { "payvia_field_id": "34", "payvia_type_id": "1", "name": "Zip Code", "type": "0", "required": "0", "min": "0", "max": "64", "orderid": "6", "is_unique": "0", "protection": "0", "check_function": "", "deleted": "0", "payvia_hash": "0", "value": "" }, { "payvia_field_id": "35", "payvia_type_id": "1", "name": "Country", "type": "0", "required": "0", "min": "0", "max": "128", "orderid": "7", "is_unique": "0", "protection": "0", "check_function": "", "deleted": "0", "payvia_hash": "0", "value": "" } ] } }
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( 'loginid' => '3', 'payvia_type_id' => 1, ); $request = Array( 'method' => 'GET', 'path' => 'v1/affiliate/payvia-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); ?>