You have two options:
public static Response adicionOrden2(*Orden2List* p) {
Response<String> r = Rest.post(SERVER_URL + "orden/adicionOrden2").
header("token", UsuarioService.getToken()).
jsonContent().
body(p.getPropertyIndex().toJSON()).getAsString();
return r;
}
Then Orden2List is just a class with a PropertyList in it.
The second option is:
public static Response adicionOrden2(Orden2[] p) {
StringBuilder array = new StringBuilder("[");
boolean first = true;
for(Orden2 current : p) {
if(!first) {
array.append(",");
first = false;
}
array.append(p.getPropertyIndex().toJSON()).getAsString());
}
array.append("]");
Response<String> r = Rest.post(SERVER_URL + "orden/adicionOrden2").
header("token", UsuarioService.getToken()).
jsonContent().
body(array.toString()).getAsString();
return r;
}
On Wednesday, October 28, 2020 at 11:42:15 PM UTC+2 [email protected] wrote:
> Hi,
> If I want to send a record from my app to update the database, I do it
> like this:
>
> public static Response adicionOrden2(Orden2 p) {
> Response<String> r = Rest.post(SERVER_URL + "orden/adicionOrden2").
> header("token", UsuarioService.getToken()).
> jsonContent().
> body(p.getPropertyIndex().toJSON()).getAsString();
> return r;
> }
>
> How can I send an ArraList?
>
--
You received this message because you are subscribed to the Google Groups
"CodenameOne Discussions" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/codenameone-discussions/0d66c945-81b9-48ba-b55a-1af16fcfd5e2n%40googlegroups.com.