1

Is it possible to put the content of this rest api in a json array to put in GET parameters instead ? And if yes, what should the code look like ?

curl_init("http://my.website.com/index.php/rest/V1/customers/search?searchCriteria[filterGroups][0][filters][0][field]=email&searchCriteria[filterGroups][0][filters][0][value]=%&searchCriteria[filterGroups][0][filters][0][condition_type]=like");
1

I finally fixed my question with http_build_query() and json_decode().

$api = "rest/V1/customers/search";

$json = '
{
    "search_criteria": {
        "filter_groups": [
            {
                "filters": [
                    {
                        "field": "email",
                        "value": "%",
                        "condition_type": "like"
                    }
                ]
            }
        ]
    }
}
';
$j = json_decode($json);
$get_params = http_build_query($j);

$ch = curl_init("http://my.website.com/index.php/".$api."?".$get_params);

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.