Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    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
    Arul
    @Arul-
    that's what needs my fix
    Can you file a bug? that way I can keep you posted
    Martin Goyot
    @Erwyn
    okay
    Arul
    @Arul-
    Thanks for contributing to Restler :+1:
    Martin Goyot
    @Erwyn
    :) thank you for taking time !
    at least I know that's not only my fault :p
    Arul
    @Arul-
    true
    Martin Goyot
    @Erwyn
    okay, done #410
    Arul
    @Arul-
    noticed it, will continue there
    Arul
    @Arul-
    @Erwyn Just commited the fix. Test and let me know
    Martin Goyot
    @Erwyn
    Hello there
    So, I'm willing to try your patch but I need to update from RC4 to RC5 or RC6 for that. Do you have any upgrade procedure for this? Cause I'm have troubles with the iAuthenticate Interface that changes and other things like this
    Arul
    @Arul-
    you may just overwrite the XmlFormat class from that commit to save some trouble
    Arul
    @Arul-
    At least for testing
    Martin Goyot
    @Erwyn
    And what should I do to upgrade from RC4 to RC5 and RC6? do you have any idea of what's required to modify?
    Arul
    @Arul-
    nothing much changed, iAuthenticate now requires one more method to be defined. Some defaults have chaneged. Many new features were added
    Martin Goyot
    @Erwyn
    okay so I'll continue my tests, something must be wrong on my side
    that has all the majour changes till RC5. RC6 is yet to be documented and released
    Martin Goyot
    @Erwyn
    mhhh okay, I don't know why but I'm experiencing Warning: Class 'Luracast\Restler\string' not found in /usr/share/restler/vendor/Luracast/Restler/AutoLoader.php on line 307
    and such things
    Arul
    @Arul-
    are you using composer?
    use composer to handle the install, update, and autoloading