Query parameters PHP
Overview
Query parameters can be used to more precisely specify what a http request should return. You can change the amount of results needed, choose the fields that you need or even add a custom condition as a parameter.
All parameters are optional.
Available parameters
Parameter |
Description |
count |
The number of items to return |
offset |
The offset from the result list (in list [1,2,3,4] offset=2 will return [3,4]) |
fields |
List of fields included in the result. Nested properties can be accessed with this notation: prop1.prop2 (if not specified, default fields set will be returned) |
sort |
String with comma separated pairs of field:order (e.g. contact.surname:asc,contact.comapnyname:desc). Result set will be sorted by included fields. |
query |
A query string to restrict the returned items to given conditions. The query string must consist of any combination of single expressions in the form property:condition. A condition may contain: wildcard "*" for any number of characters, wildcard "?" for one character, ranges in the form [value TO value] Single expressions may be combined by "AND", "OR", "NOT" operators and parenthesis '(', ')' for grouping. Property names can be nested like \"prop1.prop2\". Example: (NOT customer.name :meier*) AND (customer.age:[30 TO 40] OR customer.age:[50 TO 60]) |
Examples
Here are some examples for PaymentContractsApi but query params are applied to every not id dependent GET request.
Parameters must be given in the following order: count, offset, fields, query, sort. The default value of an unspecified param is null (e.g. Get($count, null, null, $query); )
use
Secuconnect\Client\Api\PaymentContractsApi;
$count
= 10;
//the count parameter
try
{
$response
=
$api
->paymentContractsGet(
$count
);
}
catch
(\Exception
$e
) {
// Failure. E.g. network issues.
}
use
Secuconnect\Client\Api\PaymentContractsApi;
$offset
= 2;
//the offset parameter
try
{
$response
=
$api
->paymentContractsGet(null,
$offset
);
}
catch
(\Exception
$e
) {
// Failure. E.g. network issues.
}
use
Secuconnect\Client\Api\PaymentContractsApi;
$fields
=
"object,created"
;
//the fields parameter
try
{
$response
=
$api
->paymentContractsGet(null, null,
$fields
);
}
catch
(\Exception
$e
) {
// Failure. E.g. network issues.
}
use
Secuconnect\Client\Api\PaymentContractsApi;
$query
=
"sepa_mandate_inform:never AND demo:true"
;
//the query parameter
try
{
$response
=
$api
->paymentContractsGet(null, null, null,
$query
);
}
catch
(\Exception
$e
) {
// Failure. E.g. network issues.
}
use
Secuconnect\Client\Api\PaymentContractsApi;
$sort
=
"created:desc,id:asc"
;
//the sort parameter
try
{
$response
=
$api
->paymentContractsGet(null, null, null, null,
$sort
);
}
catch
(\Exception
$e
) {
// Failure. E.g. network issues.
Possible Errors
When the response contains empty data set or the expected resuts are missing double check field names which are put into parameters.