androiddrupaldrupal-services

Android App - Drupal Services


I am trying to upload data from my Android app to my Drupal website. I know how to develop PHP code that will parse GET/POST data and save it to a database.

But, when it come to Drupal and CCK fields it is abit more challenging. From my research, the Services module is built for this sort of thing.

Can anyone enlighten me in how to setup a node.save service and how the data should be represented in the URL so that my Android data will be created as or update existing nodes?


Solution

  • To communicate with Drupal's services module you're going to need to pick a way to talk to Drupal. The Services module provides a lot of ways called "interfaces." This is basically the format of the data you send Drupal.

    A few examples of Services interfaces:

    Once you've chosen the "format" you want to send your data in, you need to translate it to that format. So let's say you choose "SOAP." Here's a good stackoverflow about sending a webservice call from Android: How to call a SOAP web service on Android

    Another thing to note is that your user must be logged in (unless anonymous users can create content!) so you must first tackle the login service!

    In review:

    1. Setup service module
    2. Choose a format such as SOAP or JSON
    3. Make a call to login the user (unless anon)
    4. Make a call to the node save service.

    Hope this helps!