Array syntax in method arguments

Some methods require an array argument. This means that square brackets with an optional index are added to the end of the argument name in a GET or POST request. The index is an integer greater than zero, indicating the position of the element in the array. For example, the request:

https://api.selzy.com/en/api/importContacts?field_names[0]=email&field_names[1]=Name

means the transfer of the field_names argument to the importContacts method as an array of two elements: email, Name.

If the index is omitted, the position of the element in the array is determined by the position of the argument in the request. For example:

https://api.selzy.com/en/api/importContacts?field_names[]=email&field_names[]=Name

results in the transfer of the same array as in the previous example.

Arrays can be multidimensional, and in this case the first pair of brackets in the argument name is followed by the second pair of brackets. In addition, the indices may not follow in the right order, and then some elements of the array will be empty. Example illustrating both of these features:

https://api.selzy.com/en/api/importContacts?data[0][0]=xxx&data[0][2]=yyy

In this case, data is a two-dimensional array in the zero string, in which only zero and second cell is filled, and the first one is empty.

Did we answer to your question?

0
0