0

as the title said, I'm looking for a method to handle a POST request made from my Android front end to my Drupal back end. I've already seen a lot of documentation and reference, like this one: http://tylerfrankenstein.com/code/build-mobile-app-sell-products-with-drupal

but I can't figure it out.

Anyone can help me?

2 Answers 2

1

Use Services

It sounds like you need to setup an API using something like a REST service. Drupal has a great module for this called Services.

Essentially you can setup your Android app to use the POST method to push to your Drupal configured endpoint. EG: https://www.mysite.com/api/android/

Services is extremely flexible and you can have it work through basic CRUD operations for nodes or you can use hooks and use custom logic for a particular service you want to use and write custom PHP code to do whatever you want.

3
  • Thank you Steve, I've already been using this module and I've created a module to read the POST data. I can't understand, eventually, why with GET method I can read them, instead with POST method I cannot. Aug 7, 2014 at 7:48
  • Try editing the existing service you've created and enable debugging mode. Also enable Drupal database logging and go to /admin/reports/dblog to see if anything jumps out. I'd recommend using something like DHC or Postman Chrome extensions to test the service out.
    – Steve
    Aug 7, 2014 at 12:14
  • The service works if I call it via web; e.g. : link. No way to get it worked out from android code. Aug 7, 2014 at 12:56
0

How about using this library for native Android applications to communicate with Drupal web servers?

Feature list:

  • Synchronous and asynchronous requests
  • Flexible object serialization / deserialization
  • API can calculate object differences to perform patch requests
  • Simple entities request
1
  • I got no problem with library, because on Android I've correctly implemented the POST request with Volley. My real problem is that I don't know how to handle it on my Drupal website. e.g. I want to check if the value passed with POST request is one rather than another one. Aug 6, 2014 at 15:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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