For a complete answer to a question, it is desirable to know the server API (in what form an object is expected) and to have an idea about the object being sent. But I will try to give a detailed answer based on the possible options.
Option 1.
The server expects an array in a URL in one of the following formats.
- Comma-delimited values. Example:
http://ex.com/doIt?array=el1,el2,el3 - Duplicate parameter name. Example:
http://ex.com/doIt?array=el1&array=el2&array=el3
These options are suitable for transmitting an array of primitive types.
Option 2.
The server expects a JSON array or object encoded with a URLEncoder or something similar. Example: http://ex.com/doIt?array=%5B%22el1%22%2C%22el2%22%2C%22el3%22%5D
Suitable for complex types.
Option 3.
The server is waiting for the object in binary form encoded in the Base64 string. Example: http://ex.com/doIt?array=YmFzZTY0U3RyaW5n
For encoding, there are standard implementations in Java 8 and Android, and third-party implementations, for example, from Apache .
Off-topic
The following does not apply to requests that do not change the status of data on the server (filtering, etc.)
Sending an object to save it to the server using a GET request is a bad design HTTP (or REST as someone like) server API. For several reasons:
- The GET method by definition of a standard must be idempotent . Those. side effects from N> 0 identical requests are the same as from a single request.
- There are restrictions on the length of the URL browsers, proxies and web servers.
- GET requests can be cached.
- A search engine crawler that somehow received such a link can do a lot of duplicates in your database.
?api=array=(и тут сам объект)This is just an example. - Ilya Shlyahovoy"array=" + bytearray.toString;- Ilya Shlyahovoy