how to Post data in an array in android using retrofit 2
i am facing a problem regarding posting data in an array in android using retrofit 2. i have to post the data of nearly 14 fields in my profile setting activity ...
Like this ...
name="basics[first_name] , name="basics[last_name]" , name="basics[phone_number]"
i have to send data in this format. i am not understanding how to do it need help.i am not understanding how to make Call of the api in the interface because i have to put data in an array.
Currently i am doing it like this but i know its not right...
@FormUrlEncoded
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(
@Query("user_id") int user_id ,
@Field("nickname") String nickname ,
@Field("first_name") String first_name ,
@Field("last_name") String last_name ,
@Field("phone_number") String phone_number ,
@Field("fax") String fax
);
java android retrofit retrofit2
|
show 10 more comments
i am facing a problem regarding posting data in an array in android using retrofit 2. i have to post the data of nearly 14 fields in my profile setting activity ...
Like this ...
name="basics[first_name] , name="basics[last_name]" , name="basics[phone_number]"
i have to send data in this format. i am not understanding how to do it need help.i am not understanding how to make Call of the api in the interface because i have to put data in an array.
Currently i am doing it like this but i know its not right...
@FormUrlEncoded
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(
@Query("user_id") int user_id ,
@Field("nickname") String nickname ,
@Field("first_name") String first_name ,
@Field("last_name") String last_name ,
@Field("phone_number") String phone_number ,
@Field("fax") String fax
);
java android retrofit retrofit2
show your url of API. except the domain name.
– sushildlh
Nov 22 '18 at 6:22
themographics.com/wordpress/doc_api/wp-json/api/v1/… this is the URL for the setting @SushilKumar
– S.H
Nov 22 '18 at 6:26
it is a POST Request
– S.H
Nov 22 '18 at 6:27
have you checked on POSTMAN ?
– sushildlh
Nov 22 '18 at 6:28
1
@SushilKumar i'm not saying its wrong. i'm talking about better approach. i believe its easy to post data as single object rather than 14 variables.
– Ali Ahmed
Nov 22 '18 at 6:35
|
show 10 more comments
i am facing a problem regarding posting data in an array in android using retrofit 2. i have to post the data of nearly 14 fields in my profile setting activity ...
Like this ...
name="basics[first_name] , name="basics[last_name]" , name="basics[phone_number]"
i have to send data in this format. i am not understanding how to do it need help.i am not understanding how to make Call of the api in the interface because i have to put data in an array.
Currently i am doing it like this but i know its not right...
@FormUrlEncoded
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(
@Query("user_id") int user_id ,
@Field("nickname") String nickname ,
@Field("first_name") String first_name ,
@Field("last_name") String last_name ,
@Field("phone_number") String phone_number ,
@Field("fax") String fax
);
java android retrofit retrofit2
i am facing a problem regarding posting data in an array in android using retrofit 2. i have to post the data of nearly 14 fields in my profile setting activity ...
Like this ...
name="basics[first_name] , name="basics[last_name]" , name="basics[phone_number]"
i have to send data in this format. i am not understanding how to do it need help.i am not understanding how to make Call of the api in the interface because i have to put data in an array.
Currently i am doing it like this but i know its not right...
@FormUrlEncoded
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(
@Query("user_id") int user_id ,
@Field("nickname") String nickname ,
@Field("first_name") String first_name ,
@Field("last_name") String last_name ,
@Field("phone_number") String phone_number ,
@Field("fax") String fax
);
java android retrofit retrofit2
java android retrofit retrofit2
asked Nov 22 '18 at 6:18
S.HS.H
548
548
show your url of API. except the domain name.
– sushildlh
Nov 22 '18 at 6:22
themographics.com/wordpress/doc_api/wp-json/api/v1/… this is the URL for the setting @SushilKumar
– S.H
Nov 22 '18 at 6:26
it is a POST Request
– S.H
Nov 22 '18 at 6:27
have you checked on POSTMAN ?
– sushildlh
Nov 22 '18 at 6:28
1
@SushilKumar i'm not saying its wrong. i'm talking about better approach. i believe its easy to post data as single object rather than 14 variables.
– Ali Ahmed
Nov 22 '18 at 6:35
|
show 10 more comments
show your url of API. except the domain name.
– sushildlh
Nov 22 '18 at 6:22
themographics.com/wordpress/doc_api/wp-json/api/v1/… this is the URL for the setting @SushilKumar
– S.H
Nov 22 '18 at 6:26
it is a POST Request
– S.H
Nov 22 '18 at 6:27
have you checked on POSTMAN ?
– sushildlh
Nov 22 '18 at 6:28
1
@SushilKumar i'm not saying its wrong. i'm talking about better approach. i believe its easy to post data as single object rather than 14 variables.
– Ali Ahmed
Nov 22 '18 at 6:35
show your url of API. except the domain name.
– sushildlh
Nov 22 '18 at 6:22
show your url of API. except the domain name.
– sushildlh
Nov 22 '18 at 6:22
themographics.com/wordpress/doc_api/wp-json/api/v1/… this is the URL for the setting @SushilKumar
– S.H
Nov 22 '18 at 6:26
themographics.com/wordpress/doc_api/wp-json/api/v1/… this is the URL for the setting @SushilKumar
– S.H
Nov 22 '18 at 6:26
it is a POST Request
– S.H
Nov 22 '18 at 6:27
it is a POST Request
– S.H
Nov 22 '18 at 6:27
have you checked on POSTMAN ?
– sushildlh
Nov 22 '18 at 6:28
have you checked on POSTMAN ?
– sushildlh
Nov 22 '18 at 6:28
1
1
@SushilKumar i'm not saying its wrong. i'm talking about better approach. i believe its easy to post data as single object rather than 14 variables.
– Ali Ahmed
Nov 22 '18 at 6:35
@SushilKumar i'm not saying its wrong. i'm talking about better approach. i believe its easy to post data as single object rather than 14 variables.
– Ali Ahmed
Nov 22 '18 at 6:35
|
show 10 more comments
3 Answers
3
active
oldest
votes
Do this way to send Json
Object as request parameters using Retrofit 2
@Headers("Content-Type: application/json")
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(@Body String body);
This is how you would use the above method to send json object
try {
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
Call<ResponseBody> userCall = apiInterface.UpdateBasics(paramObject.toString());
userCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
//handle your result here
}
@Override
public void onFailure(Call<LoginResponse> call, Throwable t) {
//handle failure
}
});
} catch (JSONException e) {
e.printStackTrace();
}
hello... what is this value_one , value_second here? @Quicklearner
– S.H
Nov 22 '18 at 7:13
your request params, like name
– Quick learner
Nov 22 '18 at 9:23
first_name, last_name etc
– Quick learner
Nov 22 '18 at 9:24
add a comment |
Make a class
public class Basic {
public final int user_id;
public final String nickname;
....
public Basic(int user_id, ...) {
}
}
Then pass list of objects of this class to this interface
public interface MyService {
@POST("/basic")
Response void sendData(@Body List<Basic> basic);
}
Or you can do the same with JSONObject. Just make a list of jsonobjects
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
put the objects in a list
list.add(paramObject);
then pass to the retrofit
public interface MyService {
@POST("/basic")
Response void sendJsonObjectData(@Body List<JSONObject> basic);
}
add a comment |
You can follow this was. (posting how i've done that)
@POST("Users.json")
Call<UploadData> uploadToken(@Body UploadData uploadData);
UploadData.class
public class UploadData {
private String DeviceToken, DeviceIMEI;
public UploadData(String deviceToken, String deviceIMEI) {
DeviceToken = deviceToken;
DeviceIMEI = deviceIMEI;
}
public String getDeviceToken() {
return DeviceToken;
}
public String getDeviceIMEI() {
return DeviceIMEI;
}
}
Then in your Activity
private void uploadToken() {
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
UploadData uploadToken = new UploadData(deviceToken, imei);
final Call<UploadData> callUpload = apiInterface.uploadToken(uploadToken);
callUpload.enqueue(new Callback<UploadData>() {
@Override
public void onResponse(Call<UploadData> call, Response<UploadData> response) {
if (response.isSuccessful()) {
Toasty.success(Main.this, "Token Uploaded !! ", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure (Call < UploadData > call, Throwable t){
call.cancel();
Toasty.error(Main.this, "Error: " + t.getLocalizedMessage(),Toast.LENGTH_SHORT).show();
}
});
}
i know how to do it its very simple i am doing it in many other apis ... but i am just confused about name="basics[last_name]" this basics
– S.H
Nov 22 '18 at 7:06
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424919%2fhow-to-post-data-in-an-array-in-android-using-retrofit-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Do this way to send Json
Object as request parameters using Retrofit 2
@Headers("Content-Type: application/json")
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(@Body String body);
This is how you would use the above method to send json object
try {
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
Call<ResponseBody> userCall = apiInterface.UpdateBasics(paramObject.toString());
userCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
//handle your result here
}
@Override
public void onFailure(Call<LoginResponse> call, Throwable t) {
//handle failure
}
});
} catch (JSONException e) {
e.printStackTrace();
}
hello... what is this value_one , value_second here? @Quicklearner
– S.H
Nov 22 '18 at 7:13
your request params, like name
– Quick learner
Nov 22 '18 at 9:23
first_name, last_name etc
– Quick learner
Nov 22 '18 at 9:24
add a comment |
Do this way to send Json
Object as request parameters using Retrofit 2
@Headers("Content-Type: application/json")
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(@Body String body);
This is how you would use the above method to send json object
try {
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
Call<ResponseBody> userCall = apiInterface.UpdateBasics(paramObject.toString());
userCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
//handle your result here
}
@Override
public void onFailure(Call<LoginResponse> call, Throwable t) {
//handle failure
}
});
} catch (JSONException e) {
e.printStackTrace();
}
hello... what is this value_one , value_second here? @Quicklearner
– S.H
Nov 22 '18 at 7:13
your request params, like name
– Quick learner
Nov 22 '18 at 9:23
first_name, last_name etc
– Quick learner
Nov 22 '18 at 9:24
add a comment |
Do this way to send Json
Object as request parameters using Retrofit 2
@Headers("Content-Type: application/json")
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(@Body String body);
This is how you would use the above method to send json object
try {
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
Call<ResponseBody> userCall = apiInterface.UpdateBasics(paramObject.toString());
userCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
//handle your result here
}
@Override
public void onFailure(Call<LoginResponse> call, Throwable t) {
//handle failure
}
});
} catch (JSONException e) {
e.printStackTrace();
}
Do this way to send Json
Object as request parameters using Retrofit 2
@Headers("Content-Type: application/json")
@POST("profile_setting/basic_setting")
Call<ResponseBody> UpdateBasics(@Body String body);
This is how you would use the above method to send json object
try {
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
Call<ResponseBody> userCall = apiInterface.UpdateBasics(paramObject.toString());
userCall.enqueue(new Callback<ResponseBody>() {
@Override
public void onResponse(Call<ResponseBody> call, Response<ResponseBody> response) {
//handle your result here
}
@Override
public void onFailure(Call<LoginResponse> call, Throwable t) {
//handle failure
}
});
} catch (JSONException e) {
e.printStackTrace();
}
answered Nov 22 '18 at 6:34
Quick learnerQuick learner
2,64511027
2,64511027
hello... what is this value_one , value_second here? @Quicklearner
– S.H
Nov 22 '18 at 7:13
your request params, like name
– Quick learner
Nov 22 '18 at 9:23
first_name, last_name etc
– Quick learner
Nov 22 '18 at 9:24
add a comment |
hello... what is this value_one , value_second here? @Quicklearner
– S.H
Nov 22 '18 at 7:13
your request params, like name
– Quick learner
Nov 22 '18 at 9:23
first_name, last_name etc
– Quick learner
Nov 22 '18 at 9:24
hello... what is this value_one , value_second here? @Quicklearner
– S.H
Nov 22 '18 at 7:13
hello... what is this value_one , value_second here? @Quicklearner
– S.H
Nov 22 '18 at 7:13
your request params, like name
– Quick learner
Nov 22 '18 at 9:23
your request params, like name
– Quick learner
Nov 22 '18 at 9:23
first_name, last_name etc
– Quick learner
Nov 22 '18 at 9:24
first_name, last_name etc
– Quick learner
Nov 22 '18 at 9:24
add a comment |
Make a class
public class Basic {
public final int user_id;
public final String nickname;
....
public Basic(int user_id, ...) {
}
}
Then pass list of objects of this class to this interface
public interface MyService {
@POST("/basic")
Response void sendData(@Body List<Basic> basic);
}
Or you can do the same with JSONObject. Just make a list of jsonobjects
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
put the objects in a list
list.add(paramObject);
then pass to the retrofit
public interface MyService {
@POST("/basic")
Response void sendJsonObjectData(@Body List<JSONObject> basic);
}
add a comment |
Make a class
public class Basic {
public final int user_id;
public final String nickname;
....
public Basic(int user_id, ...) {
}
}
Then pass list of objects of this class to this interface
public interface MyService {
@POST("/basic")
Response void sendData(@Body List<Basic> basic);
}
Or you can do the same with JSONObject. Just make a list of jsonobjects
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
put the objects in a list
list.add(paramObject);
then pass to the retrofit
public interface MyService {
@POST("/basic")
Response void sendJsonObjectData(@Body List<JSONObject> basic);
}
add a comment |
Make a class
public class Basic {
public final int user_id;
public final String nickname;
....
public Basic(int user_id, ...) {
}
}
Then pass list of objects of this class to this interface
public interface MyService {
@POST("/basic")
Response void sendData(@Body List<Basic> basic);
}
Or you can do the same with JSONObject. Just make a list of jsonobjects
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
put the objects in a list
list.add(paramObject);
then pass to the retrofit
public interface MyService {
@POST("/basic")
Response void sendJsonObjectData(@Body List<JSONObject> basic);
}
Make a class
public class Basic {
public final int user_id;
public final String nickname;
....
public Basic(int user_id, ...) {
}
}
Then pass list of objects of this class to this interface
public interface MyService {
@POST("/basic")
Response void sendData(@Body List<Basic> basic);
}
Or you can do the same with JSONObject. Just make a list of jsonobjects
JSONObject paramObject = new JSONObject();
paramObject.put(value_one, "field_one"));
paramObject.put(value_second, "field_second"));
put the objects in a list
list.add(paramObject);
then pass to the retrofit
public interface MyService {
@POST("/basic")
Response void sendJsonObjectData(@Body List<JSONObject> basic);
}
answered Nov 22 '18 at 6:36
NIKHIL MAURYANIKHIL MAURYA
1319
1319
add a comment |
add a comment |
You can follow this was. (posting how i've done that)
@POST("Users.json")
Call<UploadData> uploadToken(@Body UploadData uploadData);
UploadData.class
public class UploadData {
private String DeviceToken, DeviceIMEI;
public UploadData(String deviceToken, String deviceIMEI) {
DeviceToken = deviceToken;
DeviceIMEI = deviceIMEI;
}
public String getDeviceToken() {
return DeviceToken;
}
public String getDeviceIMEI() {
return DeviceIMEI;
}
}
Then in your Activity
private void uploadToken() {
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
UploadData uploadToken = new UploadData(deviceToken, imei);
final Call<UploadData> callUpload = apiInterface.uploadToken(uploadToken);
callUpload.enqueue(new Callback<UploadData>() {
@Override
public void onResponse(Call<UploadData> call, Response<UploadData> response) {
if (response.isSuccessful()) {
Toasty.success(Main.this, "Token Uploaded !! ", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure (Call < UploadData > call, Throwable t){
call.cancel();
Toasty.error(Main.this, "Error: " + t.getLocalizedMessage(),Toast.LENGTH_SHORT).show();
}
});
}
i know how to do it its very simple i am doing it in many other apis ... but i am just confused about name="basics[last_name]" this basics
– S.H
Nov 22 '18 at 7:06
add a comment |
You can follow this was. (posting how i've done that)
@POST("Users.json")
Call<UploadData> uploadToken(@Body UploadData uploadData);
UploadData.class
public class UploadData {
private String DeviceToken, DeviceIMEI;
public UploadData(String deviceToken, String deviceIMEI) {
DeviceToken = deviceToken;
DeviceIMEI = deviceIMEI;
}
public String getDeviceToken() {
return DeviceToken;
}
public String getDeviceIMEI() {
return DeviceIMEI;
}
}
Then in your Activity
private void uploadToken() {
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
UploadData uploadToken = new UploadData(deviceToken, imei);
final Call<UploadData> callUpload = apiInterface.uploadToken(uploadToken);
callUpload.enqueue(new Callback<UploadData>() {
@Override
public void onResponse(Call<UploadData> call, Response<UploadData> response) {
if (response.isSuccessful()) {
Toasty.success(Main.this, "Token Uploaded !! ", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure (Call < UploadData > call, Throwable t){
call.cancel();
Toasty.error(Main.this, "Error: " + t.getLocalizedMessage(),Toast.LENGTH_SHORT).show();
}
});
}
i know how to do it its very simple i am doing it in many other apis ... but i am just confused about name="basics[last_name]" this basics
– S.H
Nov 22 '18 at 7:06
add a comment |
You can follow this was. (posting how i've done that)
@POST("Users.json")
Call<UploadData> uploadToken(@Body UploadData uploadData);
UploadData.class
public class UploadData {
private String DeviceToken, DeviceIMEI;
public UploadData(String deviceToken, String deviceIMEI) {
DeviceToken = deviceToken;
DeviceIMEI = deviceIMEI;
}
public String getDeviceToken() {
return DeviceToken;
}
public String getDeviceIMEI() {
return DeviceIMEI;
}
}
Then in your Activity
private void uploadToken() {
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
UploadData uploadToken = new UploadData(deviceToken, imei);
final Call<UploadData> callUpload = apiInterface.uploadToken(uploadToken);
callUpload.enqueue(new Callback<UploadData>() {
@Override
public void onResponse(Call<UploadData> call, Response<UploadData> response) {
if (response.isSuccessful()) {
Toasty.success(Main.this, "Token Uploaded !! ", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure (Call < UploadData > call, Throwable t){
call.cancel();
Toasty.error(Main.this, "Error: " + t.getLocalizedMessage(),Toast.LENGTH_SHORT).show();
}
});
}
You can follow this was. (posting how i've done that)
@POST("Users.json")
Call<UploadData> uploadToken(@Body UploadData uploadData);
UploadData.class
public class UploadData {
private String DeviceToken, DeviceIMEI;
public UploadData(String deviceToken, String deviceIMEI) {
DeviceToken = deviceToken;
DeviceIMEI = deviceIMEI;
}
public String getDeviceToken() {
return DeviceToken;
}
public String getDeviceIMEI() {
return DeviceIMEI;
}
}
Then in your Activity
private void uploadToken() {
ApiInterface apiInterface = ApiClient.getClient().create(ApiInterface.class);
UploadData uploadToken = new UploadData(deviceToken, imei);
final Call<UploadData> callUpload = apiInterface.uploadToken(uploadToken);
callUpload.enqueue(new Callback<UploadData>() {
@Override
public void onResponse(Call<UploadData> call, Response<UploadData> response) {
if (response.isSuccessful()) {
Toasty.success(Main.this, "Token Uploaded !! ", Toast.LENGTH_LONG).show();
}
}
@Override
public void onFailure (Call < UploadData > call, Throwable t){
call.cancel();
Toasty.error(Main.this, "Error: " + t.getLocalizedMessage(),Toast.LENGTH_SHORT).show();
}
});
}
answered Nov 22 '18 at 6:43
Ali AhmedAli Ahmed
1,3891314
1,3891314
i know how to do it its very simple i am doing it in many other apis ... but i am just confused about name="basics[last_name]" this basics
– S.H
Nov 22 '18 at 7:06
add a comment |
i know how to do it its very simple i am doing it in many other apis ... but i am just confused about name="basics[last_name]" this basics
– S.H
Nov 22 '18 at 7:06
i know how to do it its very simple i am doing it in many other apis ... but i am just confused about name="basics[last_name]" this basics
– S.H
Nov 22 '18 at 7:06
i know how to do it its very simple i am doing it in many other apis ... but i am just confused about name="basics[last_name]" this basics
– S.H
Nov 22 '18 at 7:06
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53424919%2fhow-to-post-data-in-an-array-in-android-using-retrofit-2%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
show your url of API. except the domain name.
– sushildlh
Nov 22 '18 at 6:22
themographics.com/wordpress/doc_api/wp-json/api/v1/… this is the URL for the setting @SushilKumar
– S.H
Nov 22 '18 at 6:26
it is a POST Request
– S.H
Nov 22 '18 at 6:27
have you checked on POSTMAN ?
– sushildlh
Nov 22 '18 at 6:28
1
@SushilKumar i'm not saying its wrong. i'm talking about better approach. i believe its easy to post data as single object rather than 14 variables.
– Ali Ahmed
Nov 22 '18 at 6:35