Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Anders Friis
    @anfriis
    Hi, i can't figure out how to disable caching of GET requests. Can you help me?
    Arul
    @Arul-
    Restler avoids caching by default. Why do you think it is a caching issue? How do you consume the api? Is it via an mobile app?
    Arul
    @Arul-
    Problem should be at the client side
    Anders Friis
    @anfriis
    Ahh okay, i think the documentation is a bit confusing about wether it is enabled or not as default. I have solved it and disabled caching. The problem was my hosting server that still had caching enabled even though i turned it off in CPanel. But thanks for the reply
    Arul
    @Arul-
    Glad to hear that your problem is resolved
    Joey
    @JPAntonisse
    Good afternoon
    Could someone help me with starting a clean restler project?
    I can't figure out the 404 error: "not found" (in json format).
    i installed a fresh restler project with composer
    i added the .htaccess that is described in the restler setup.
    Evandro Zanatta
    @ezanattatray
    Hello
    Arul
    @Arul-
    404 is not always a bad news. In your case it indcates your installation is working properly as you see json output.
    Arul
    @Arul-
    I guess you are trying the base url where no api is mapped. Try the following
    class Home {
        public function index(){
            return array( ‘success’ => true, ‘message’ => ‘Restler is working properly’);
        }
    }
    
    //in index.php after the restler initialisation
    $r->addApiClass(‘Home’, ‘’); // mapping to root
    Martin Goyot
    @Erwyn
    Hello
    I have a problem using XML for POST request
    particularly in case of arrays
    Martin Goyot
    @Erwyn
    When you only have one element left
    for instance:
    // JSON multi-entry array
    [
        {"some-property": 123},
        {"some-property": 124}
    ]
    
    // XML Equivalent
    <item>
        <something>
            <some-property>
                123
            </some-property>
        </something>
        <something>
            <some-property>
                124
            </some-property>
        </something>
    </item>
    this works fine
    on php side I have:
    array( 
        0 => array( "some-property" => 123), 
        1 => array("some-property" => 124)
    )
    Martin Goyot
    @Erwyn

    Now with an array with a single element:

    // JSON multi-entry array
    [
        {"some-property": 123}
    ]
    
    // XML Equivalent
    <item>
        <something>
            <some-property>
                123
            </some-property>
        </something>
    </item>

    I got on php side:

    // JSON
    
    array( 
        0 => array( "some-property" => 123)
    )
    
    // XML 
    
    array( "some-property" => 123)
    My question is to know how to have the same format on php side (like Json) for both ?
    Martin Goyot
    @Erwyn

    Now with an array with a single element:

    // JSON multi-entry array
    [
        {"some-property": 123}
    ]
    
    // XML Equivalent
    <item>
        <something>
            <some-property>
                123
            </some-property>
        </something>
    </item>

    I got on php side:

    // JSON
    
    array( 
        0 => array( "some-property" => 123)
    )
    
    // XML 
    
    array( "some-property" => 123)
    Arul
    @Arul-

    I just tried Restler RC6 with the following xml

    <response><item><some-property>123</some-property></item></response>

    I got the following php data

    array (
      'item' => 
      array (
        'some-property' => '123',
      ),
    )

    Is this what you are looking for?

    Arul
    @Arul-
    OK I guess you need the item to be a numeric index. At present this is not possible, will work on a fix for that
    Martin Goyot
    @Erwyn
    nono the problem is not numeric index
    my problem is that I have a difference between json and xml
    Arul
    @Arul-
    If there is a numeric index they will become consistent
    Martin Goyot
    @Erwyn
    // JSON multi-entry array
    [
        {"some-property": 123}
    ]
    returns
    array( 
        0 => array( "some-property" => 123)
    )

    where

    <item>
        <something>
            <some-property>
                123
            </some-property>
        </something>
    </item>

    returns

    array( "some-property" => 123)
    so the problem is just in the case of an array containing only one element
    maybe there is a way to declare it is an array?
    with XML ?
    Arul
    @Arul-

    Actually it returns

    array (
      'item' => 
      array (
        'some-property' => '123',
      ),
    )

    for me

    it will be perfect if it can return
    array (
      0 => 
      array (
        'some-property' => '123',
      ),
    )
    instead
    Martin Goyot
    @Erwyn
    yes