PHP-sdk client   Download ApiQL App   Support the project ♥

ApiQL.net

ApiQL project
Documentation

*generated by ApiQL.net
Last updated: 14:34:39 | 20.04.2024

This is an demo project of the ApiQL.net application.
The advantage of using this application is to build rest API (including documentation) for your existing MySQL database.

..and YES! ONLY in few minutes!!!

ApiQL project is using ApiQL.net Rest API builder to provide fast, secure and reliable Rest API.

ApiQL.net is powerful and simple translation of SQL queries into Rest API and come's together with dynamic PHP-sdk client.

Why ApiQL.net?

There are a lot advantages why you should use ApiQL.net.

Advantages:
  • Simple and intuitive sintax
  • Minimum system requirements
  • Flexible to use multiple tables on same API call (using views)
  • Converts automatically all tables and views into endpoints
  • Reliable and secure
  • Ready documentation for your api project
  • Easy configure call methods (enable/disable)
  • 100% controll which tables and views can have endpoints
  • Unset specific or sensitive fields

System Requirements

Enjoy our minimal system requirements. You can start ApiQL.net even on shared hosting.

  • PHP version 5.6 or newer is recommended
  • MySQL version 5.6 or greater OR MariaDB version 10.1 or greater.

ApiQL-SDK client

The ApiQL.net library includes dynamic PHP-sdk client, so if your client is based on PHP, you'll be able to use service on easiest way ever!

If you decide to use this sdk library, you can download here.

Installation

Installation is very easy. You have to chose between our 2 options:

  • Manual installation
  • Composer installation
  • Manual installation

    Manual installation is simple. All you need to do is:

    Composer installation

    Composer installation is recommended if you prefer to use ApiQL as package for some existing Application or Framework.

    Follow the instructions bellow for installation using composer:

    • Connect to your server via SSH client
      
        ssh user@yourWebsiteOrIP
      
      
    • Go to root of your webserver or subfolder where you plan to host ApiQL app
      
        cd /path/to/your/webserver/root/subfolder
      
      
    • Install latest version using composer
      
        composer require mihajlo/apiql
      
      
    • After installation include autoloader into your index.php file
      
        require_once('vendor/autoload.php');
      
      
    • After installation please follow the configuration instructions

    Configuration

    Configuration for ApiQL is very easy.
    Simply go to ./config/config.php file and fill the array.

    Example configuration:

    
        $config = [
            //required general config
            'app_name' => 'Your project name here', //this title will appear in your documentation
            'app_desc' => 'Your project description..',
            'base_url' => 'http://yourdomainhere.com/apiFolder/', //base path to your api project
            'token' => 'auth_token_here', //token that is required for api user authentication
            'max_limit_per_page' => 100, //limit the max results per page
            'default_per_page' => 10, //if not set as parameter, 10 results per page is default
            //list of the end-points and their allowed actions *endpoints are existing tables and views in your db and `list` means get all and get single record 
            'allowed_actions' => [
                'tablename' => ['list', 'add', 'edit', 'delete'],
                'tablename2' => ['list', 'add', 'edit', 'delete'],
                'tablename3' => ['list', 'add', 'edit', 'delete'],
                'other_table_name' => ['list', 'add', 'edit', 'delete'],
            ],
            'debug' => false, //set to `true` if you want to see real SQLs that API execute
            'defaultStatusMessages' => [
                200 => 'OK',
                401 => 'Autherntication failed!',
                403 => 'Not allowed!',
                404 => 'End-point not found!',
                405 => 'Bad request',
                500 => 'Internal server error!'
            ],
            //required DB config
            'hostname' => 'localhost',
            'username' => 'dbusername',
            'password' => 'dbpassword',
            'database' => 'dbname',
            'dbdriver' => 'mysqli'
        ];
    
    

    If we want to change configuration "on the fly", we can do this directly in the main index file.

    Example:

    
        require_once './config/config.php';
        require_once './src/Apiql.php';
    
        //init the ApiQL library
        $ApiQL = new Apiql($config);
    
        $ApiQL->config->debug = true;
    
        //we can connect ApiQL with some existing logic and make dynamic tokens
        $ApiQL->config->token = 'new_token_here';
    
        //additional configuration
        $ApiQL->config->allowed_actions['newtable'] = ['list', 'add'];
        $ApiQL->config->allowed_actions['newtable2'] = ['list', 'add', 'edit', 'delete'];
        $ApiQL->config->disabled_columns = ['email', 'password']; //this will unset sensitive fields from table
    
        $ApiQL->handleRequest();
    
    

    Endpoints

    List of the available endpoints and their actions:

    /author

    https://apiql.net/author

    Use `/author` endpoint to list records, get specific record by id, add, edit or delete record.
    Also you can check POST vars for `/author` endpoint.


    /author
    List - get all items

    Request-type: HTTP / GET
    content-type: multipart/form-data


    Simple usage for listing author

    This type of usage will select all fields and will keep default pagination and sorting options.

    https://apiql.net/author?token=auth_token_here
    
    curl -X GET 'https://apiql.net/author?token=auth_token_here' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $response = $ApiQL->get_author();
    
    if ($response) {
        print_r($response);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/author?token=auth_token_here';
    $jsonResponse = file_get_contents($url);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['author']);
    exit();
    
    
    
    $.getJSON('https://apiql.net/author?token=auth_token_here',function(r){
        console.log(r.author);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).author;
        console.log(response_data);
      }
    });
    xhr.open("GET", "https://apiql.net/author?token=auth_token_here");
    xhr.send();
    
    


    Selecting specific fields from author

    This type of usage will select only fields that you'll include as URL parameters (Query String).
    All available fields for author are: author.id, author.author, author.city, author.country_code, author.email, author.linkedin_link, author.github_link, author.facebook_link
    Ex. &field[endpoint.field]=alias_here&field[endpoint.field2]
    *Alias is optional

    https://apiql.net/author?token=auth_token_here&field[author.id]=author_id&field[author.author]=author_author&field[author.city]=author_city&field[author.country_code]=author_country_code&field[author.email]=author_email&field[author.linkedin_link]=author_linkedin_link&field[author.github_link]=author_github_link&field[author.facebook_link]=author_facebook_link
    
    curl -X GET 'https://apiql.net/author?token=auth_token_here&field[author.id]=author_id&field[author.author]=author_author&field[author.city]=author_city&field[author.country_code]=author_country_code&field[author.email]=author_email&field[author.linkedin_link]=author_linkedin_link&field[author.github_link]=author_github_link&field[author.facebook_link]=author_facebook_link' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $response = $ApiQL->get_author('all', [
        'field' => [
            'author.some_field' => 'some_field_alias',
            'author.some_field2' => 'some_field2_alias',
            'author.some_field3' => 'some_field3_alias'
        ],
        'page' => 1,
        'limit' => 10,
        //'sort' => ['author.some_field' => 'DESC', 'author.some_field2' => 'ASC'],
        //'search' => ['author.some_field' => 'some_keyword', 'author.some_field2' => 'some_keyword2'],
        //'filter' => ['author.some_field' => 'some_value', 'author.some_field2' => 'some_value2'],
    ]);
    
    if ($response) {
        print_r($response);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $fields = ['field' => []];
    $fields['field']['author.id'] = 'author_id';
    $fields['field']['author.author'] = 'author_author';
    $fields['field']['author.city'] = 'author_city';
    $fields['field']['author.country_code'] = 'author_country_code';
    $fields['field']['author.email'] = 'author_email';
    $fields['field']['author.linkedin_link'] = 'author_linkedin_link';
    $fields['field']['author.github_link'] = 'author_github_link';
    $fields['field']['author.facebook_link'] = 'author_facebook_link';
    
    $fieldsQueryString = http_build_query($fields);
    $url = 'https://apiql.net/author?token=auth_token_here&' . $fieldsQueryString;
    $jsonResponse = file_get_contents($url);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['author']);
    exit();
    
    
    
    $.getJSON('https://apiql.net/author',
    {
      "token" : "auth_token_here",
      "field" : {
        "author.id" : "author_id",
        "author.author" : "author_author",
        "author.city" : "author_city",
        "author.country_code" : "author_country_code",
        "author.email" : "author_email",
        "author.linkedin_link" : "author_linkedin_link",
        "author.github_link" : "author_github_link",
        "author.facebook_link" : "author_facebook_link"
      }
    }
    ,function(r){
        console.log(r.author);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).author;
        console.log(response_data);
      }
    });
    xhr.open("GET", "https://apiql.net/author?token=auth_token_here&field[author.id]=author_id&field[author.author]=author_author&field[author.city]=author_city&field[author.country_code]=author_country_code&field[author.email]=author_email&field[author.linkedin_link]=author_linkedin_link&field[author.github_link]=author_github_link&field[author.facebook_link]=author_facebook_link");
    xhr.send();
    
    

    Same as selecting fields you can do more advanced operations in your API query.
    Here is the list:

    • Limit

      You can limit data (number of records per page) by simply adding `limit` parameter as query string:
      &limit=50

    • Sort

      You can sort items in result-set by one or more fields.
      This is how you can use this option:
      &sort[author.example_field_name1]=desc&sort[author.example_field_name2]=asc

    • Search

      You can search by single or multiple values. Search will also check in the part of the word for selected field.
      Search parameters can be appear like:
      &search[author.author]=keyword&search[author.other_field_name]=keyword2

    • Filter

      Very similar like search, filter can also filter response data by single or multiple fields. Compared with search, filter will check only exact data value.
      Filter parameters can be appear like:
      &filter[author.id]=some_value&filter[author.other_field_name]=some_value

    • Merge

      This will execute JOIN in the background. This option is needed when you need to collect data from more then one tables. If you also like to fetch data from additional tables, you should define in fields in same way &field[new_table.field]=alias
      This is how merge parameters should looks like:
      &merge[new_table_name.id]=this_end_point_field_name
      This will execute SQL JOIN like:
      INNER JOIN `new_table_name` ON `new_table_name`.`id` = `author`.`this_end_point_field_name`
      * Alternatively you can create MySQL view and thread exactly as table with needed tables and search criteria. This way ApiQL will show as separate endpoint. ;)

    • Add subitem in response

      Use `add` param if you like to add record from other table. This will run separate sql and will include needed record instead key from the selected alias. This is how add parameters should looks like:
      &add[needed_table.foreign_key]=alias_from_selected_field * Please note: For this option alias of selected field needs to have value from the primary key of the needed table.



    /author/{id}
    get single record by id

    Request-type: HTTP / GET
    content-type: multipart/form-data


    Get single record from author

    This type of usage will select all fields for the single record. You can select only specific fields like on list call.

    https://apiql.net/author/{id}?token=auth_token_here
    
    curl -X GET 'https://apiql.net/author/{id}?token=auth_token_here' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $item = $ApiQL->get_author('{id}');
    
    if ($item) {
        print_r($item);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/author/{id}?token=auth_token_here';
    $jsonResponse = file_get_contents($url);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['author']);
    exit();
    
    
    
    $.getJSON('https://apiql.net/author/{id}?token=auth_token_here',function(r){
        console.log(r.author);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).author;
        console.log(response_data);
      }
    });
    xhr.open("GET", "https://apiql.net/author/{id}?token=auth_token_here");
    xhr.send();
    
    


    /author
    add record

    Request-type: HTTP / POST
    content-type: multipart/form-data


    Add record to author

    This type of usage will insert record.
    You can see all possible fields for this call on POST vars section

    https://apiql.net/author?token=auth_token_here
    
    curl -X GET 'https://apiql.net/author?token=auth_token_here' -H 'content-type: multipart/form-data' -F author=value -F city=value -F country_code=value -F email=value -F linkedin_link=value -F github_link=value -F facebook_link=value ;
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $insert_id = $ApiQL->add_author([
        'author' => 'value_here',
        'city' => 'value_here',
        'country_code' => 'value_here',
        'email' => 'value_here',
        'linkedin_link' => 'value_here',
        'github_link' => 'value_here',
        'facebook_link' => 'value_here',
    ]);
    
    if ($insert_id) {
        print_r($insert_id);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/author?token=auth_token_here';
    $postVars=[];
    $postVars['author'] = 'value_here'
    $postVars['city'] = 'value_here'
    $postVars['country_code'] = 'value_here'
    $postVars['email'] = 'value_here'
    $postVars['linkedin_link'] = 'value_here'
    $postVars['github_link'] = 'value_here'
    $postVars['facebook_link'] = 'value_here'
    $opts = ['http' =>
        [
            'method'  => 'POST',
            'header'  => 'Content-Type: application/x-www-form-urlencoded',
            'content' => http_build_query($postVars)
        ]
    ];
    $jsonResponse = file_get_contents($url, false, $context);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['author']);
    exit();
    
    
    
    $.post('https://apiql.net/author?token=auth_token_here',
    {
    "author" : "value_here",
    "city" : "value_here",
    "country_code" : "value_here",
    "email" : "value_here",
    "linkedin_link" : "value_here",
    "github_link" : "value_here",
    "facebook_link" : "value_here"
    }
    ,function(r){
        console.log(r.author);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var data = new FormData();
    data.append("author", "value_here");
    data.append("city", "value_here");
    data.append("country_code", "value_here");
    data.append("email", "value_here");
    data.append("linkedin_link", "value_here");
    data.append("github_link", "value_here");
    data.append("facebook_link", "value_here");
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).author;
        console.log(response_data);
      }
    });
    
    xhr.open("POST", "https://apiql.net/author?token=auth_token_here");
    xhr.send(data);
    
    


    /author/{id}
    edit record

    Request-type: HTTP / POST
    content-type: multipart/form-data


    Edit record from author

    This type of usage will update record on author.
    You can see all possible fields for this call on POST vars section

    https://apiql.net/author/{id}?token=auth_token_here
    
    curl -X GET 'https://apiql.net/author/{id}?token=auth_token_here' -H 'content-type: multipart/form-data' -F author=value -F city=value -F country_code=value -F email=value -F linkedin_link=value -F github_link=value -F facebook_link=value ;
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $edit_response_id = $ApiQL->edit_author('{id}', [
        'author' => 'new_value_here',
        'city' => 'new_value_here',
        'country_code' => 'new_value_here',
        'email' => 'new_value_here',
        'linkedin_link' => 'new_value_here',
        'github_link' => 'new_value_here',
        'facebook_link' => 'new_value_here',
    ]);
    
    if ($edit_response_id) {
        print_r($edit_response_id);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/author/{id}?token=auth_token_here';
    $postVars=[];
    $postVars['author'] = 'value_here'
    $postVars['city'] = 'value_here'
    $postVars['country_code'] = 'value_here'
    $postVars['email'] = 'value_here'
    $postVars['linkedin_link'] = 'value_here'
    $postVars['github_link'] = 'value_here'
    $postVars['facebook_link'] = 'value_here'
    $opts = ['http' =>
        [
            'method'  => 'POST',
            'header'  => 'Content-Type: application/x-www-form-urlencoded',
            'content' => http_build_query($postVars)
        ]
    ];
    $jsonResponse = file_get_contents($url, false, $context);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['author']);
    exit();
    
    
    
    $.post('https://apiql.net/author/{id}?token=auth_token_here',
    {
    "author" : "value_here",
    "city" : "value_here",
    "country_code" : "value_here",
    "email" : "value_here",
    "linkedin_link" : "value_here",
    "github_link" : "value_here",
    "facebook_link" : "value_here"
    }
    ,function(r){
        console.log(r.author);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var data = new FormData();
    data.append("author", "value_here");
    data.append("city", "value_here");
    data.append("country_code", "value_here");
    data.append("email", "value_here");
    data.append("linkedin_link", "value_here");
    data.append("github_link", "value_here");
    data.append("facebook_link", "value_here");
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).author;
        console.log(response_data);
      }
    });
    
    xhr.open("POST", "https://apiql.net/author/{id}?token=auth_token_here");
    xhr.send(data);
    
    


    /author/{id}
    delete single record by id

    Request-type: HTTP / DELETE
    content-type: multipart/form-data


    Delete single record from author

    This type of usage will delete single record.

    https://apiql.net/author/{id}?token=auth_token_here
    
    curl -X DELETE 'https://apiql.net/author/{id}?token=auth_token_here' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $delete_author = $ApiQL->delete_author('{id}');
    
    if ($delete_author) {
        print_r($delete_author);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/author/{id}?token=auth_token_here';
    $jsonResponse = file_get_contents($url, false, stream_context_create(['http' => ['method' => 'DELETE']]));
    $response = json_decode($jsonResponse, true);
    
    print_r($response['author']);
    exit();
    
    
    
    $.ajax({
        url: 'https://apiql.net/author/{id}?token=auth_token_here',
        type: 'DELETE',
        success: function(r) {
            console.log(r.author);
        }
    });
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).author;
        console.log(response_data);
      }
    });
    xhr.open("DELETE", "https://apiql.net/author/{id}?token=auth_token_here");
    xhr.send();
    
    



    POST vars for /author:
    Parameter Type Required Default * Note
    author string Yes Max. length: 200
    city string No Max. length: 100
    country_code string Yes Max. length: 2
    email string Yes Max. length: 150
    linkedin_link string No Max. length: 250
    github_link string No Max. length: 200
    facebook_link string No Max. length: 250

    /information

    https://apiql.net/information

    Use `/information` endpoint to list records, get specific record by id, add, edit or delete record.
    Also you can check POST vars for `/information` endpoint.


    /information
    List - get all items

    Request-type: HTTP / GET
    content-type: multipart/form-data


    Simple usage for listing information

    This type of usage will select all fields and will keep default pagination and sorting options.

    https://apiql.net/information?token=auth_token_here
    
    curl -X GET 'https://apiql.net/information?token=auth_token_here' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $response = $ApiQL->get_information();
    
    if ($response) {
        print_r($response);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/information?token=auth_token_here';
    $jsonResponse = file_get_contents($url);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['information']);
    exit();
    
    
    
    $.getJSON('https://apiql.net/information?token=auth_token_here',function(r){
        console.log(r.information);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).information;
        console.log(response_data);
      }
    });
    xhr.open("GET", "https://apiql.net/information?token=auth_token_here");
    xhr.send();
    
    


    Selecting specific fields from information

    This type of usage will select only fields that you'll include as URL parameters (Query String).
    All available fields for information are: information.id, information.property, information.value
    Ex. &field[endpoint.field]=alias_here&field[endpoint.field2]
    *Alias is optional

    https://apiql.net/information?token=auth_token_here&field[information.id]=information_id&field[information.property]=information_property&field[information.value]=information_value
    
    curl -X GET 'https://apiql.net/information?token=auth_token_here&field[information.id]=information_id&field[information.property]=information_property&field[information.value]=information_value' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $response = $ApiQL->get_information('all', [
        'field' => [
            'information.some_field' => 'some_field_alias',
            'information.some_field2' => 'some_field2_alias',
            'information.some_field3' => 'some_field3_alias'
        ],
        'page' => 1,
        'limit' => 10,
        //'sort' => ['information.some_field' => 'DESC', 'information.some_field2' => 'ASC'],
        //'search' => ['information.some_field' => 'some_keyword', 'information.some_field2' => 'some_keyword2'],
        //'filter' => ['information.some_field' => 'some_value', 'information.some_field2' => 'some_value2'],
    ]);
    
    if ($response) {
        print_r($response);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $fields = ['field' => []];
    $fields['field']['information.id'] = 'information_id';
    $fields['field']['information.property'] = 'information_property';
    $fields['field']['information.value'] = 'information_value';
    
    $fieldsQueryString = http_build_query($fields);
    $url = 'https://apiql.net/information?token=auth_token_here&' . $fieldsQueryString;
    $jsonResponse = file_get_contents($url);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['information']);
    exit();
    
    
    
    $.getJSON('https://apiql.net/information',
    {
      "token" : "auth_token_here",
      "field" : {
        "information.id" : "information_id",
        "information.property" : "information_property",
        "information.value" : "information_value"
      }
    }
    ,function(r){
        console.log(r.information);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).information;
        console.log(response_data);
      }
    });
    xhr.open("GET", "https://apiql.net/information?token=auth_token_here&field[information.id]=information_id&field[information.property]=information_property&field[information.value]=information_value");
    xhr.send();
    
    

    Same as selecting fields you can do more advanced operations in your API query.
    Here is the list:

    • Limit

      You can limit data (number of records per page) by simply adding `limit` parameter as query string:
      &limit=50

    • Sort

      You can sort items in result-set by one or more fields.
      This is how you can use this option:
      &sort[information.example_field_name1]=desc&sort[information.example_field_name2]=asc

    • Search

      You can search by single or multiple values. Search will also check in the part of the word for selected field.
      Search parameters can be appear like:
      &search[information.property]=keyword&search[information.other_field_name]=keyword2

    • Filter

      Very similar like search, filter can also filter response data by single or multiple fields. Compared with search, filter will check only exact data value.
      Filter parameters can be appear like:
      &filter[information.id]=some_value&filter[information.other_field_name]=some_value

    • Merge

      This will execute JOIN in the background. This option is needed when you need to collect data from more then one tables. If you also like to fetch data from additional tables, you should define in fields in same way &field[new_table.field]=alias
      This is how merge parameters should looks like:
      &merge[new_table_name.id]=this_end_point_field_name
      This will execute SQL JOIN like:
      INNER JOIN `new_table_name` ON `new_table_name`.`id` = `information`.`this_end_point_field_name`
      * Alternatively you can create MySQL view and thread exactly as table with needed tables and search criteria. This way ApiQL will show as separate endpoint. ;)

    • Add subitem in response

      Use `add` param if you like to add record from other table. This will run separate sql and will include needed record instead key from the selected alias. This is how add parameters should looks like:
      &add[needed_table.foreign_key]=alias_from_selected_field * Please note: For this option alias of selected field needs to have value from the primary key of the needed table.



    /information/{id}
    get single record by id

    Request-type: HTTP / GET
    content-type: multipart/form-data


    Get single record from information

    This type of usage will select all fields for the single record. You can select only specific fields like on list call.

    https://apiql.net/information/{id}?token=auth_token_here
    
    curl -X GET 'https://apiql.net/information/{id}?token=auth_token_here' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $item = $ApiQL->get_information('{id}');
    
    if ($item) {
        print_r($item);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/information/{id}?token=auth_token_here';
    $jsonResponse = file_get_contents($url);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['information']);
    exit();
    
    
    
    $.getJSON('https://apiql.net/information/{id}?token=auth_token_here',function(r){
        console.log(r.information);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).information;
        console.log(response_data);
      }
    });
    xhr.open("GET", "https://apiql.net/information/{id}?token=auth_token_here");
    xhr.send();
    
    


    /information
    add record

    Request-type: HTTP / POST
    content-type: multipart/form-data


    Add record to information

    This type of usage will insert record.
    You can see all possible fields for this call on POST vars section

    https://apiql.net/information?token=auth_token_here
    
    curl -X GET 'https://apiql.net/information?token=auth_token_here' -H 'content-type: multipart/form-data' -F property=value -F value=value ;
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $insert_id = $ApiQL->add_information([
        'property' => 'value_here',
        'value' => 'value_here',
    ]);
    
    if ($insert_id) {
        print_r($insert_id);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/information?token=auth_token_here';
    $postVars=[];
    $postVars['property'] = 'value_here'
    $postVars['value'] = 'value_here'
    $opts = ['http' =>
        [
            'method'  => 'POST',
            'header'  => 'Content-Type: application/x-www-form-urlencoded',
            'content' => http_build_query($postVars)
        ]
    ];
    $jsonResponse = file_get_contents($url, false, $context);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['information']);
    exit();
    
    
    
    $.post('https://apiql.net/information?token=auth_token_here',
    {
    "property" : "value_here",
    "value" : "value_here"
    }
    ,function(r){
        console.log(r.information);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var data = new FormData();
    data.append("property", "value_here");
    data.append("value", "value_here");
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).information;
        console.log(response_data);
      }
    });
    
    xhr.open("POST", "https://apiql.net/information?token=auth_token_here");
    xhr.send(data);
    
    


    /information/{id}
    edit record

    Request-type: HTTP / POST
    content-type: multipart/form-data


    Edit record from information

    This type of usage will update record on information.
    You can see all possible fields for this call on POST vars section

    https://apiql.net/information/{id}?token=auth_token_here
    
    curl -X GET 'https://apiql.net/information/{id}?token=auth_token_here' -H 'content-type: multipart/form-data' -F property=value -F value=value ;
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $edit_response_id = $ApiQL->edit_information('{id}', [
        'property' => 'new_value_here',
        'value' => 'new_value_here',
    ]);
    
    if ($edit_response_id) {
        print_r($edit_response_id);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/information/{id}?token=auth_token_here';
    $postVars=[];
    $postVars['property'] = 'value_here'
    $postVars['value'] = 'value_here'
    $opts = ['http' =>
        [
            'method'  => 'POST',
            'header'  => 'Content-Type: application/x-www-form-urlencoded',
            'content' => http_build_query($postVars)
        ]
    ];
    $jsonResponse = file_get_contents($url, false, $context);
    $response = json_decode($jsonResponse, true);
    
    print_r($response['information']);
    exit();
    
    
    
    $.post('https://apiql.net/information/{id}?token=auth_token_here',
    {
    "property" : "value_here",
    "value" : "value_here"
    }
    ,function(r){
        console.log(r.information);
    }).fail(function(error){
        console.log(error.responseJSON);
    });
    
    
    
    var data = new FormData();
    data.append("property", "value_here");
    data.append("value", "value_here");
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).information;
        console.log(response_data);
      }
    });
    
    xhr.open("POST", "https://apiql.net/information/{id}?token=auth_token_here");
    xhr.send(data);
    
    


    /information/{id}
    delete single record by id

    Request-type: HTTP / DELETE
    content-type: multipart/form-data


    Delete single record from information

    This type of usage will delete single record.

    https://apiql.net/information/{id}?token=auth_token_here
    
    curl -X DELETE 'https://apiql.net/information/{id}?token=auth_token_here' -H 'content-type: multipart/form-data;'
    
    
    
    $ApiQL = new ApiQL('https://apiql.net/', 'auth_token_here');
    
    $delete_information = $ApiQL->delete_information('{id}');
    
    if ($delete_information) {
        print_r($delete_information);
    } else {
        print_r($ApiQL->error()->status_code);
        print_r($ApiQL->error()->status_msg);
    }
    
    
    
    $url = 'https://apiql.net/information/{id}?token=auth_token_here';
    $jsonResponse = file_get_contents($url, false, stream_context_create(['http' => ['method' => 'DELETE']]));
    $response = json_decode($jsonResponse, true);
    
    print_r($response['information']);
    exit();
    
    
    
    $.ajax({
        url: 'https://apiql.net/information/{id}?token=auth_token_here',
        type: 'DELETE',
        success: function(r) {
            console.log(r.information);
        }
    });
    
    
    
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("readystatechange", function () {
      if (this.readyState === 4) {
        var response_data=JSON.parse(this.responseText).information;
        console.log(response_data);
      }
    });
    xhr.open("DELETE", "https://apiql.net/information/{id}?token=auth_token_here");
    xhr.send();
    
    



    POST vars for /information:
    Parameter Type Required Default * Note
    property string Yes Max. length: 100
    value string (big) No /