Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I'm creating a simple Unity lense for my college site which is based on Drupal, but I don't know how to adapt this command for Drupal API. Please help, it's python.

We now create our query url, using the Wikipedia opensearch API url = ("%s/w/api.php?action=opensearch&limit=25&format=json&search=%s" % (self.wiki, search))

I'm using template to write lense following Wikipedia example http://developer.ubuntu.com/2012/04/how-to-create-a-wikipedia-unity-lens-for-ubuntu/. I don't know python but Im familiar with C. This Drupal API calling is the only problem I have to successfully develop a lense. Please help!

share|improve this question
    
Does Drupal even have a search API you can call? –  mhall119 Jun 7 '12 at 12:26
add comment

1 Answer

Drupal does not have a built-in facility for returning search results as JSON. You could use the contributed services_search module, which exposes a URL on your site such as http://example.com/services/search_node/retrieve.json?keys=whatever.

If you don't want to add the Services module to your site for some reason, you could write a custom module that uses the Drupal function search_data() to retrieve search results and then outputs them as JSON.

(Either way, you'll have to add something to your Drupal site, which makes this not an Ubuntu-specific question, so it should probably be moved to the Drupal SE site.)

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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