Hi,

I can't seem to get more than a single argument passed to a services view. I read that ampersand & is the separator, as I'd expect, but can't get any of the following to work, the second argument seems to be ignored.

/api/rest/views/viewname.json?args=value1&value2
/api/rest/views/viewname.json?args=value1+value2
/api/rest/views/viewname.json?args=value1/value2
/api/rest/views/viewname.json?args=value1,value2
/api/rest/views/viewname.json?args=value1|value2

I'm using the titanium mobile framework and the above form is what I've have seen used and it is working perfectly for my views with only one argument. When the second argument is optional, it is ignored, if it is required, the view returns an empty result.

Any help is greatly appreciated.

Thanks,
Paul.

CommentFileSizeAuthor
#6 views-services-find_block_number.jpg62.79 KBMD3
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ygerasimov’s picture

Category: bug » support

Sorry I am not sure I understand the question. You are mentioning passing standard GET variables.

What value do you expect to be received? If you need to pass array of arguments you should pass as

/api/rest/views/viewname.json?args[0]=value1&args[1]=value2

Does this solve your issue?

This is support request rather than bug.

mccrodp’s picture

Status: Active » Fixed

Genius! Yes this definitely solves the issue, many thanks.
Yes, my apologies, I realise now that it was a support request, but I read somewhere (unsure where now unfortunately) that multiple view arguments were passed in the form 'args=value1&value2', so I thought it wasn't working.

The array of arguments makes much more sense anyways.

Many thanks.

Status: Fixed » Closed (fixed)

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

MD3’s picture

Just in case anyone else runs across this and gets a little confused. Let's say your view name is styles, your block is block 4 (look at the link when you hover over it), your first argument is a user id (uid) of 12, and you have paging set up at 20 results/page and you want to see the third page (remember, 0, 1, 2) or results 40-60:

/views/styles?display_id=block_4&args[0]=12&page=2

From what I understand, you must list your arguments in order you see them in your view. Can one of the module maintainers confirm this?

tinflute’s picture

Hi MD5,
Can you clarify when you say "your block is block 4 (look at the link when you hover over it)", what is 'it' here?
What link in edit views page reveals the id of the view display?

Also, can anyone say whether argument passing works in the 6.x version of this module?
I've got the service view generating nicely, but so far unsuccessful with passing arguments.

MD3’s picture

Hi tinflute,

Must be doing hashing too much (I'm MD3 ;-) )!! Please see the following picture to more clearly define where you can find the block #.

views-services-find_block_number.jpg

I can also confirm that this does work in D6. Are you trying to use this for a regular browser or a REST interface?

tinflute’s picture

Hi MD3, Thanks very much for the helpful reply.
I am trying to use this for a REST interface, but have been testing it out in a browser and with HttpRequester.

I think what's been stumping me is that the key-value format and accepted ordering of arguments, filters, sorts.
It's a tricky one to debug since we can't use the browser for debugging messages.

sreekanth1201’s picture

Assigned: Unassigned » sreekanth1201

Hi,

Am still facing this problem..I have created a contextual filter.How can i pass the argument/arguments.I tried http://localhost/site_name/views/view_name?args[0]=xyz

No result is displaying here.

Please help.

Thanks,
Sreekanth

anbudhan’s picture

Hi I am trying to get data from drupal service api using postman.

https://btycc-prod..net/api/v1/entity_commerce_product?parameters[create...
can some one tell me how to get set the parameter to download lesserthan a specific date?
I tried https://bcc-prod.codeenigma.net/api/v1/entity_commerce_product?parameter... <=1428930969:

but it is not working. any help will be hugely appreciated