NATS5 REST API Site GET site
From TMM Wiki
(Redirected from NATS4 REST API Site GET site)
Jump to navigationJump to searchGET /site/site
Description
- Get site details
Resource URL
- http://domain/api/site/site
- Replace domain with the nats domain
- GET
Response Format
- JSON
- HTTP headers
Parameters
Parameters can be sent as url encoded params
- siteid
- type: digit
- required
- default_tour
- type: boolean_digit (0 or 1)
- optional
Example Request
Method: GET
URL: http://domain/api/site/site
Query String: siteid=1&default_tour=1
Response:
{ "success": true, "site": { "siteid": "1", "networkid": "0", "site": "member_a", "deleted": "0", "name": "Membership Site A", "type": "0", "hidden": "0", "date_added": "1533096000", "date_live": "0", "network": "0", "reuse_active": "0", "no_personal_member_info": "0", "mobile_tour": "0", "site_group_id": "0", "featured": "1", "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", "mobile_tour_nice": "None Selected", "site_group_nice": "None", "default_tour": { "tourid": "1", "tour": "MAIN", "siteid": "1", "networkid": "0", "name": "Default Tour", "url": "https:\/\/www.google.com", "linkdomain": "root.nats4.com", "description": "", "inherit_default_description": "1", "thumb": "", "thumb_ext": "", "third_party_partner_id": "0", "spartaurl": "", "denyurl": "", "inherit_default_denyurl": "1", "denypost": "", "inherit_default_denypost": "1", "approvalurl": "", "inherit_default_approvalurl": "1", "approvalpost": "", "inherit_default_approvalpost": "1", "rebillpost": "", "inherit_default_rebillpost": "1", "creditpost": "", "inherit_default_creditpost": "1", "chargebackpost": "", "inherit_default_chargebackpost": "1", "insufficient_fundpost": "", "inherit_default_insufficient_fundpost": "1", "voidpost": "", "inherit_default_voidpost": "1", "userpost": "", "inherit_default_userpost": "1", "userman": "", "inherit_default_userman": "1", "expirepost": "", "inherit_default_expirepost": "1", "custom": "", "admin_signup_email": "", "inherit_default_admin_signup_email": "1", "admin_rebill_email": "", "inherit_default_admin_rebill_email": "1", "admin_cancelled_email": "", "inherit_default_admin_cancelled_email": "1", "admin_credited_email": "", "inherit_default_admin_credited_email": "1", "admin_chargeback_email": "", "inherit_default_admin_chargeback_email": "1", "admin_voided_email": "", "inherit_default_admin_voided_email": "1", "admin_insufficient_email": "", "inherit_default_admin_insufficient_email": "1", "admin_void_reversal_email": "", "inherit_default_admin_void_reversal_email": "1", "admin_credit_reversal_email": "", "inherit_default_admin_credit_reversal_email": "1", "admin_chargeback_reversal_email": "", "inherit_default_admin_chargeback_reversal_email": "1", "admin_insufficient_reversal_email": "", "inherit_default_admin_insufficient_reversal_email": "1", "admin_change_email": "", "inherit_default_admin_change_email": "1", "upgradeurl": "", "inherit_default_upgradeurl": "1", "upgradepost": "", "inherit_default_upgradepost": "1", "allowed_lang": "", "inherit_default_allowed_lang": "1", "alternativeurl": "", "inherit_default_alternativeurl": "1", "allowed_lang_track_raw": "0", "allowed_lang_track_unq": "0", "hidden": "0", "mail_member_joined": "", "inherit_default_mail_member_joined": "1", "mail_member_cancelled": "", "inherit_default_mail_member_cancelled": "1", "mail_member_rebilled": "", "inherit_default_mail_member_rebilled": "1", "mail_member_credited": "", "inherit_default_mail_member_credited": "1", "mail_member_chargedback": "", "inherit_default_mail_member_chargedback": "1", "mail_member_insufficient": "", "inherit_default_mail_member_insufficient": "1", "mail_member_voided": "", "inherit_default_mail_member_voided": "1", "upgradedenyurl": "", "inherit_default_upgradedenyurl": "1", "upgradedenypost": "", "inherit_default_upgradedenypost": "1", "prejoinpost": "", "inherit_default_prejoinpost": "1", "byo_owner": "0", "byo_program": "0", "byo_owner_only": "0", "deleted": "0", "niche": "", "inherit_default_niche": "1", "strack_programid": "0", "mail_member_change": "", "inherit_default_mail_member_change": "1", "change_detailspost": "", "inherit_default_change_detailspost": "1", "created_date": "1533153391", "mail_member_password": "Password Retrieval", "inherit_default_mail_member_password": "1", "credit_reversal_post": "", "inherit_default_credit_reversal_post": "1", "chargeback_reversal_post": "", "inherit_default_chargeback_reversal_post": "1", "void_reversal_post": "", "inherit_default_void_reversal_post": "1", "insufficient_funds_reversal_post": "", "inherit_default_insufficient_funds_reversal_post": "1", "mail_member_insufficient_reversal": "", "inherit_default_mail_member_insufficient_reversal": "1", "mail_member_void_reversal": "", "inherit_default_mail_member_void_reversal": "1", "mail_member_credit_reversal": "", "inherit_default_mail_member_credit_reversal": "1", "mail_member_chargeback_reversal": "", "inherit_default_mail_member_chargeback_reversal": "1", "admin_threshold_email": "", "inherit_default_admin_threshold_email": "1", "mail_threshold": "", "inherit_default_mail_threshold": "1", "join_hit_threshold_hour_to_6": "", "inherit_default_join_hit_threshold_hour_to_6": "1", "join_hit_threshold_hour_to_12": "", "inherit_default_join_hit_threshold_hour_to_12": "1", "join_hit_threshold_hour_to_18": "", "inherit_default_join_hit_threshold_hour_to_18": "1", "join_hit_threshold_hour_to_24": "", "inherit_default_join_hit_threshold_hour_to_24": "1", "mail_member_pending_joined": "", "inherit_default_mail_member_pending_joined": "1", "mail_member_pre_joined": "", "inherit_default_mail_member_pre_joined": "1", "mail_member_pending_rebilled": "", "inherit_default_mail_member_pending_rebilled": "1", "mail_member_pre_rebilled": "", "inherit_default_mail_member_pre_rebilled": "1", "pre_approvalpost": "", "inherit_default_pre_approvalpost": "1", "pending_approvalpost": "", "inherit_default_pending_approvalpost": "1", "pre_rebillpost": "", "inherit_default_pre_rebillpost": "1", "pending_rebillpost": "", "inherit_default_pending_rebillpost": "1", "https_use": "1", "tour_type": "0", "mail_member_nocostjoined": "", "inherit_default_mail_member_nocostjoined": "1", "nocost_approvalpost": "", "inherit_default_nocost_approvalpost": "1", "packageurl": "", "inherit_default_packageurl": "1", "packagedenyurl": "", "inherit_default_packagedenyurl": "1", "packagedenypost": null, "inherit_default_packagedenypost": "1", "packagepost": null, "inherit_default_packagepost": "1", "gateway_join_text": "", "inherit_default_gateway_join_text": "1", "gateway_join_disclaimer": "", "inherit_default_gateway_join_disclaimer": "1", "join_disclaimer": "", "inherit_default_join_disclaimer": "1", "join_text": "", "inherit_default_join_text": "1", "tokenrebuyurl": "", "inherit_default_tokenrebuyurl": "1", "tokenrebuydenyurl": "", "inherit_default_tokenrebuydenyurl": "1", "allowed_lang_track_join": "0", "dupeurl": "", "inherit_default_dupeurl": "1", "mail_member_igm_joined": "Signup Receipt", "inherit_default_mail_member_igm_joined": "1", "mail_member_pending_ncr": "Verify Your Free Registration", "pending_ncrpost": "", "inherit_default_mail_member_pending_ncr": "1", "https_tracking": "0", "gateway_https": "", "https_display": "0", "inherit_default_https_display": "0", "mail_member_conversion": "", "inherit_default_mail_member_conversion": "", "member_captcha": "0", "userman_secret_key": "", "inherit_default_userman_secret_key": "0", "cancelpost": "", "inherit_default_cancelpost": "1", "cookie_domain": "0", "inherit_default_pending_ncrpost": "1", "inherit_default_member_captcha": "1", "mail_member_joined_enabled": "0", "inherit_mail_member_joined_enabled": "1", "inherit_default_https_tracking": "1" } } }
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( 'siteid' => 1, 'default_tour' => 1, ); $request = Array( 'method' => 'GET', 'path' => 'v1/site/site', '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); ?>