Sometimes external endpoints require parameters to be passed via the GET request... for example, an api key.

It will be easy to support this. We simply need to add a multivalue form with a key field and a value field. Any parameters that are added can be appended to the endpoint URI that is sent in to the function.

Comments

Anonymous’s picture

Status: Active » Needs review
StatusFileSize
new7.53 KB

This patch:

  • Adds an options field to the database table
  • Adds an options fieldset to the form
  • Adds a query parameters multivalue form field that takes key and value
  • Uses those query parameters in _sparql_remote_query

It alters the data structure of the form to something that will be easier to handle in the API. Developers will be able to declare a SPARQL Registry entry as follows:

'example' => array(
  'title' => 'Example',
  'uri' => 'http://example.org/sparql',
  'options' => array(
    'query_parameters' => array(
      'apikey' => 'foobar',
    ),
  ),
)

Further work

The key and value form fields should display next to each other. I'm also considering whether it makes sense for Advanced Query Options to be a vertical tabs fieldset.

Anonymous’s picture

StatusFileSize
new7.93 KB

Rerolling because of changes in dev. This currently throws notices, but I'm going to leave at needs review because they aren't critical.

Anonymous’s picture

StatusFileSize
new7.74 KB

Messed up the order on the update functions. This patch corrects that.

clayball’s picture

This patch looks good. However, I did not test _sparql_remote_query. I'll try to test this later today. Maybe someone else can test the _sparql_remote_query functionality.

Anonymous’s picture

Thanks for the review :)

I have tested the remote query, but would be happy to have someone else check it out as well

darrenmothersele’s picture

Hi Lin,

I needed this patch as I attended an Open Government Data Hackday with Kasabi yesterday. I couldn't get the patch to apply against the latest dev version, but I applied the patch manually.

I had to make one extra addition in order to get this working. I had to unserialize the $endpoint->options array within the _sparql_init_remote_store() function.

I successfully queried a SPARQL Endpoint on Kasabi, using the following:

SPARQL Views 7.x-2.0-alpha4
SPARQL API 7.x-2.0-dev (26th July) (+patched)
RDFx 7.x-2.0-alpha2
Views 7.x-3.0-rc1

Anonymous’s picture

Status: Needs review » Fixed

Awesome, thanks for reviewing :)

I'm going to commit this now. We need to switch SPARQL Registry over to using Entity API to get the free features integration. As part of that, I'll write tests for this functionality.

Fixed with commit http://drupalcode.org/project/sparql.git/commit/fc5e4d6

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.