tag_name example

Comments

4 comments

  • Avatar
    Chris Muench

    Are you passing the api key in as a header? Here is an example for getting all items

    <?php

    //////////////////////////////////////////////////////////
    $api_base_url = 'https://demo.phppointofsale.com/index.php/api/v1/';
    $api_key = '4g0880o0ko8cksw84ws4gc8gocc4sg0kwccsck4o';
    ///////////////////////////////////////////////////////////


    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $api_base_url.'items');
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'x-api-key:'.$api_key,
    'accept: application/json',
    ));
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    $result = json_decode(curl_exec($curl), TRUE);
    echo '<pre>';
    var_dump($result);
    echo '</pre>';

    0
    Comment actions Permalink
  • Avatar
    Cdmyursar

    Yes I am. I was using the url as an example of some of the stuff I tried to return tag searches.

    0
    Comment actions Permalink
  • Avatar
    Chris Muench

    Just tested this on demo and it works

     

    <?php

    //////////////////////////////////////////////////////////
    $api_base_url = 'https://demo.phppointofsale.com/index.php/api/v1/';
    $api_key = 'c08048s0ksgcoo4wgkkggscg08wswsggsgs44k4o';
    ///////////////////////////////////////////////////////////


    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $api_base_url.'items?search=ABC&search_field=tag_name');
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'x-api-key:'.$api_key,
    'accept: application/json',
    ));
    curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

    $result = json_decode(curl_exec($curl), TRUE);
    echo '<pre>';
    var_dump($result);
    echo '</pre>';

     

    0
    Comment actions Permalink
  • Avatar
    Cdmyursar

    Thank you Chris, I understand now. Also, it works! Thanks again.

    0
    Comment actions Permalink

Please sign in to leave a comment.