My Android developer and I are having trouble posting the JSON data to our drupal services. I am not familiar with Java but I have used Httpposter to post my JSON data to create nodes on my site. We are trying to accomplish this with JAVA but his multidimensional arrays aren't ending up like we need them. Has anyone had experience with Java and Drupal services posting a Drupal node from an android device. Any help would be greatly appreciated. Here is a sample of the JSON that needs sent to the server from our Android app.

    "title":"Services added sale with image fix # 2",
        "value":"This is the body field"
        "thoroughfare":"711 B Ave W",
      "und":"Garage Sale"},

This works with Httpposter so i know services is working fine.

  • Can you also post how the JSON is currently getting through to Drupal? – Eduard Luca Nov 2 '12 at 2:04
  • I have experiance in android and drupal development but I don't get the point what your problem is... – rekire Nov 3 '12 at 20:07
  • If your Drupal service is working fine using HTTP Poster, then there may not be issue from Drupal side. Problem may lie with the way you are calling a Drupal service from Java. Anyway, you need to post more about what error you are getting. What do you mean by "his multidimensional arrays aren't ending up like we need them" ? How are they ending up? Is there an encoding issue when sending data? Posting relevant Java code might be helpful in answering this question. – Ajinkya Kulkarni Nov 4 '12 at 17:02

Here I am sharing the example for JSON format of drupal 7 services, here I am using POST method to register/create a user.

Endpoint URL : http://localhost/project/api/user/register Method : POST. Request Header : Content-Type/application/json. Body :

"name" : "your_username",
"mail" : "email_id@example.com",
"pass" :"password",
"field_first_name": {"und": [{"value": "Rahul"}]},
"field_last_name": {"und": [{"value": "Sankrit"}]},
"field_custom_entity_reference": { "und": [ "2" ] },
"field_mobile_number": {"und": [{"value": "99XXXXXX12"}]}


Not the answer you're looking for? Browse other questions tagged or ask your own question.