AnsweredAssumed Answered

Problem with Request on addFeature rest using httppost java

Question asked by mtw.nda@hotmail.com on Jan 27, 2015
Latest reply on Oct 6, 2016 by greg.stevenson

Hello,
I'm Trying to add a new Feature on my Server,but i'm having some problems

 

theres my code :

ArrayList<NameValuePair> postParameters;
  postParameters = new ArrayList<NameValuePair>();
     postParameters.add(new BasicNameValuePair("features", gson.toJson(UploadTasks.get("addFeatures"))));
     postParameters.add(new BasicNameValuePair("gdbVersion", "SDE.DEFAULT"));
     postParameters.add(new BasicNameValuePair("rollbackOnFailure", "true"));
     postParameters.add(new BasicNameValuePair("f", "pjson"));

HttpPost httppost = new HttpPost(urlsvaluepairs.getKey() + index + "/addFeatures");
  httppost.setEntity(new UrlEncodedFormEntity(postParameters));
  httppost.setHeader("Accept", "application/json");
  httppost.setHeader("Content-type", "application/json");
  try {
  String Res = httpclient.execute(httppost, new BasicResponseHandler());
  } catch (NetworkOnMainThreadException e) {
  e.printStackTrace();
  }
  //UpdateNewFeatures
  httppost = new HttpPost(urlsvaluepairs.getKey() + index + "/addFeatures?f=pjson");
  httppost.setEntity(new ByteArrayEntity(gson.toJson(UploadTasks.get("updateFeatures")).replace("\\", "").getBytes("UTF8")));
  httppost.setHeader("Accept", "application/json");
  httppost.setHeader("Content-type", "application/json");
  try {
  String Res = httpclient.execute(httppost, new BasicResponseHandler());
  } catch (NetworkOnMainThreadException e) {
  e.printStackTrace();
  }

 

 

the error returned to me is :

 

 

Unable to complete operation. Parser error: Some parameters could not be recognized.

 

someone can help-me ?

 

thanks!

Outcomes