NATS5 REST API Site GET option
From TMM Wiki
(Redirected from NATS4 REST API Site GET option)
Jump to navigationJump to searchGET /site/option
Description
- Get option details
Resource URL
- http://domain/api/site/option
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Parameters can be sent as url encoded params
- optionid
- type: digit
- required
- formatted
- type: boolean_digit (0 or 1)
- optional
- option_biller
- type: boolean_digit (0 or 1)
- optional
Example Request
Method: GET
URL: http://domain/api/site/option
Query String: optionid=2&formatted=1&option_biller=1
Response:
{ "success": true, "option": { "optionid": "2", "siteid": "2", "networkid": "0", "deleted": "0", "enabled": "0", "orderid": "1", "option_type_id": "0", "billerid": "0", "programid": "0", "legacy": "0", "siteid_nice": "test site name", "biller_details": [ { "billerid": "2", "biller": "CCBILL", "fields": [ { "display": "CC Payment ID", "required": "1", "size": "6", "type": "", "name": "biller_optioninfo_subscriptionTypeId_cc", "value": "", "required_type": "cc", "display_value": "" }, { "display": "Check Payment ID", "required": "1", "size": "6", "type": "", "name": "biller_optioninfo_subscriptionTypeId_check", "value": "", "required_type": "check", "display_value": "" }, { "display": "Web900 Payment ID", "required": "1", "size": "6", "type": "", "name": "biller_optioninfo_subscriptionTypeId_900", "value": "", "required_type": "900", "display_value": "" }, { "display": "Debit Payment ID", "required": "1", "size": "6", "type": "", "name": "biller_optioninfo_subscriptionTypeId_elv", "value": "", "required_type": "elv", "display_value": "" }, { "display": "Direct Pay Payment ID", "required": "1", "size": "6", "type": "", "name": "biller_optioninfo_subscriptionTypeId_dp", "value": "", "required_type": "dp", "display_value": "" }, { "display": "Alter-Sub", "required": "0", "size": "6", "type": "", "name": "biller_optioninfo_clientSubacc", "value": "", "display_value": "" }, { "display": "Alter-Upgrade", "required": "0", "size": "6", "type": "", "name": "biller_optioninfo_upgradesub", "value": "", "display_value": "" }, { "display": "Alter CC Form", "required": "0", "size": "6", "type": "", "name": "biller_optioninfo_formName_cc", "value": "", "display_value": "" }, { "display": "Alter Check Form", "required": "0", "size": "6", "type": "", "name": "biller_optioninfo_formName_check", "value": "", "display_value": "" }, { "display": "Alter Web900 Form", "required": "0", "size": "6", "type": "", "name": "biller_optioninfo_formName_900", "value": "", "display_value": "" }, { "display": "Alter Debit Form", "required": "0", "size": "6", "type": "", "name": "biller_optioninfo_formName_elv", "value": "", "required_type": "elv", "display_value": "" }, { "display": "Alter Direct Pay Form", "required": "0", "size": "6", "type": "", "name": "biller_optioninfo_formName_dp", "value": "", "required_type": "dp", "display_value": "" } ] }, { "billerid": "1", "biller": "NETBILLING", "fields": [ { "display": "Auth Amount ($0 initial only)", "required": "0", "size": "", "type": "", "name": "biller_optioninfo_auth_amount", "value": "", "display_value": "" }, { "display": "Discount Upgrade Price", "required": "0", "size": "", "type": "", "name": "biller_optioninfo_upgradeprice", "value": "", "display_value": "" }, { "display": "Disable Initial AVS", "required": "0", "size": "1", "type": "checkbox", "name": "biller_optioninfo_disable_avs", "value": "", "display_value": "No" }, { "display": "Disable Initial Fraud Checking", "required": "0", "size": "1", "type": "checkbox", "name": "biller_optioninfo_disable_fraud_checking", "value": "", "display_value": "No" }, { "display": "Enable Oneclick AVS", "required": "0", "size": "1", "type": "checkbox", "name": "biller_optioninfo_enable_oneclick_avs", "value": "", "display_value": "No" }, { "display": "Enable Oneclick Fraud Checking", "required": "0", "size": "1", "type": "checkbox", "name": "biller_optioninfo_enable_oneclick_fraud_checking", "value": "", "display_value": "No" }, { "display": "Packageplus Prorate", "required": "0", "size": "1", "type": "checkbox", "name": "biller_optioninfo_prorate", "value": "", "display_value": "No" }, { "display": "Free Trial No Auth", "required": "0", "size": "1", "type": "checkbox", "name": "biller_optioninfo_free_trial_no_auth", "value": "", "display_value": "No" } ] } ], "details": { "name": "Join Form", "initial": "1", "initial_days": "1", "rebill": "30", "rebill_days": "30", "no_old_members": "0", "initial_dec": "$1.00", "rebill_dec": "$30.00", "trial": 1, "active_all": "0" }, "is_gateway": 0, "details_formatted": [ { "name": "name", "display": "Join Form Text", "required": true, "section": "main", "special_design": true, "value": "Join Form", "display_value": "Join Form" }, { "name": "initial", "display": "Initial Cost", "check": "alnum_number_check", "section": "main", "special_design": true, "value": "1", "display_value": "1" }, { "name": "initial_days", "display": "Initial Days", "check": "alnum_number_check", "section": "main", "special_design": true, "value": "1", "display_value": "1" }, { "name": "rebill", "display": "Recurring Cost", "check": "alnum_number_check", "section": "main", "special_design": true, "value": "30", "display_value": "30" }, { "name": "rebill_days", "display": "Recurring Days", "check": "alnum_number_check", "section": "main", "special_design": true, "value": "30", "display_value": "30" }, { "name": "package_upgrade_allowed", "display": "Package Upgrade Allowed", "type": "checkbox", "section": "package", "special_design": true, "value": "", "display_value": "No" }, { "name": "enable_global_package_upgrade", "display": "Package Upgrade Globally", "type": "checkbox", "section": "package", "special_design": true, "value": "", "display_value": "No" }, { "name": "package_use_initial", "display": "Package Use Initial", "type": "checkbox", "section": "package", "special_design": true, "value": "", "display_value": "No" }, { "name": "packageid", "display": "Package ID", "check": "alnum_number_check", "section": "package", "special_design": true, "value": "", "display_value": "" }, { "name": "no_old_members", "display": "Disallow for Old Members", "type": "checkbox", "section": "misc", "special_design": false, "value": "0", "display_value": "No" }, { "name": "hidden", "display": "Hide on Join Form", "type": "checkbox", "section": "misc", "special_design": false, "value": "", "display_value": "No" }, { "name": "active_all", "display": "Active by Default", "type": "checkbox", "section": "misc", "special_design": false, "value": "0", "display_value": "No" } ], "name": "Join Form", "initial": "1", "initial_days": "1", "rebill": "30", "rebill_days": "30", "no_old_members": "0", "initial_dec": "$1.00", "rebill_dec": "$30.00", "trial": 1, "active_all": "0", "site": { "siteid": "2", "networkid": "0", "site": "testSite", "deleted": "0", "name": "test site name", "type": "0", "hidden": "0", "date_added": "1559932173", "date_live": "0", "network": "0", "reuse_active": "0", "no_personal_member_info": "0", "mobile_tour": "0", "site_group_id": "0", "featured": "0", "brand_id": "0", "require_atvod_verification": "0", "atvod_client_id": "", "atvod_operator_id": "", "atvod_password": "", "atvod_authenticate_profile_id": "", "atvod_passport_profile_id": "", "atvod_driving_licence_profile_id": "", "type_nice": "Membership", "site_group_nice": "None" } }, "option_type": { "key": 0, "name": "normal", "mapping": "optioninfo", "special": 0, "nosite": 0, "extra_offers": 1, "incoming_sale": 0, "rule_type": "option" } }
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( 'optionid' => 2, 'formatted' => 1, 'option_biller' => 1, ); $request = Array( 'method' => 'GET', 'path' => 'v1/site/option', '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); ?>