Closed (fixed)
Project:
Services Views
Version:
7.x-1.x-dev
Component:
Miscellaneous
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
20 Feb 2013 at 17:55 UTC
Updated:
13 Jun 2014 at 16:24 UTC
Jump to comment: Most recent
Comments
Comment #1
dippers commentedDo you actually mean before the 'services view' (before the view is built and rendered) or do you mean before the output is sent from the endpoint (after the view is rendered)? The latter can be done using:
and the modify the result array.
Comment #2
cdmo commentedThanks, I didn't ask this question, but I did have the same one and that function helped me alter the json output of a service.
I wonder, is this hook (or any other Services Views hooks) documented anywhere?
version: 7.x-1.0-beta2
Comment #3
ygerasimov commentedI have added basic documentation about hook_services_request_preprocess_alter() and hook_services_request_postprocess_alter() hooks to Services module.
Comment #4
cdmo commentedThank you very much!
Comment #5
dereckd commentedThis does seem to address the output of altering the view it's self, but I'm interested in altering the output of the field only. For instance, no matter how I attempt to format things, the user image is always output as a url in HTML .... I would like to strip the html before the services output.
Comment #6
dippers commentedThe way I got around this was to write a custom field formatter to output raw urls. You could also do it using views-php of a display suite custom field but they will all require some php knowledge.
Comment #7
dippers commentedThe following will give you a custom field formatter for images and cropped images.
Comment #8
dereckd commentedThat is exactly what I was looking for, for my use case I ended up using a very simple approach to the formatter
I'm still a bit confused about the #markup portion of the array, but none the less it works exactly like I wanted
Thanks
Comment #10
DrCord commentedI was dealing with an issue with IP addresses not being converted from long to an actual IP, the hook_services_request_postprocess_alter hook helped!
Here's the code: