Not possible to make request with multi value parameter

Issue #42 invalid
Ashley Cutmore created an issue

In the Bitbucket API, when endpoint parameters take multiple values the format is foo=x&foo=y

e.g issues?status=new&status=open

Parameters are currently passed in as an array and encoded with http_build_query which turns multi-dimensional arrays into

foo[0]=x&foo[1]=y

Comments (3)

  1. Alexandru Guzinschi

    This could be an issue if you disabled NormalizeArrayListener which is enabled by default and should take care of this things.

    If you disabled it, you should enable it back and then any value which is an array, will be transformed automatically to match the format accepted by the API server.

    $issues = new \Bitbucket\API\Repositories\Issues();
    // auth if needed
    $issues->all($account, $repo, array(
        'limit'  => 5,
        'status' => array('new', 'resolved')
    ));
    

    Will result in ?limit=5&status=new&status=resolved

    Same things apply for request body.

    This solves your issue ?

  2. Log in to comment