Getting smobnation's API

Getting smobnation's API

Posted on : 26 Sep, 2022    |    Last Update - 2 months ago   

Follow this link API

Our API allows you to retrieve informations from our website via GET request and supports the following query parameters:

How to start?


  1. Create a development application.
     
  2. Once you have created the app, you'll get APP_ID, and APP_SECRET.
    Example:


     
  3. To start the Oauth process, use the link https://app.smobnation.com/oauth?app_id={YOUR_APP_ID}
     
  4. Once the end user clicks this link, he/she will be redirected to the authorization page.
     
  5. Once the end user authorization the app, he/she will be redirected to your domain name with a GET parameter "code", example: http://yourdomain/?code=XXX
     
  6. In your code, to retrieve the authorized user info, you need to generate an access code, please use the code below:
     
    1. PHP:
      <?php
      $app_id = 'YOUR_APP_ID'; // your application app id
      $app_secret = 'YOUR_APP_SECRET'; your application app secret
      $code = $_GET['code']; // the GET parameter you got in the callback: http://yourdomain/?code=XXX
      
      $get = file_get_contents("https://app.smobnation.com/authorize?app_id={$app_id}&app_secret={$app_secret}&code={$code}");
      
      $json = json_decode($get, true);
      if (!empty($json['access_token'])) {
          $access_token = $json['access_token']; // your access token
      }
      ?>
  7. Once you got the access code, simple call the data you would like to retrieve, Example:
     
    1. PHP:
      if (!empty($json['access_token'])) {
         $access_token = $json['access_token']; // your access token
         $type = "get_user_data"; // or posts_data
         $get = file_get_contents("https://app.smobnation.com/app_api?access_token={$access_token}&type={$type}");
      }
      
    2. Respond:
      Jsonoutput
      {
          "api_status": "success",
          "api_version": "1.3",
          "user_data": {
              "id": "",
              "username": "",
              "first_name": "",
              "last_name": "",
              "gender": "",
              "birthday": "",
              "about": "",
              "website": "",
              "facebook": "",
              "twitter": "",
              "vk": "",
              "google+": "",
              "profile_picture": "",
              "cover_picture": "",
              "verified": "",
              "url": ""
          }
      }
      

Still No Luck ? We can help you

Create a ticket, we’ll get back to you as soon as possible.

Submit a Ticket