Services
This is a discussion and working group for anyone interested in the Services module and related modules. This module was created out of a need for a standardized solution of integrating external applications with Drupal, specifically Flash and Flex applications. Visit the issues page for all bug reports. Also visit the Services Handbook for information and examples.
Drupal Authorization
Hello. I am trying to get services using authorization to work but I am running into an issue. I have services 6.x-1.x-dev installed, key authentication, json server and xmlrpc server. I have the node,search,system,user and views service turned on and I am running the latest stable drupal 6. I am trying to use the python script below to connect and return a node from services (I have also tried with a view and also using php but run into similar problems). If I go to site building -> services -> settings and remove the use keys and use sessid (and don't send the auth.
"Token has been used previously for a request"
Thanks for the help everyone. I finally got the c# program logged in and reading nodes correctly with an API key.
Now the exception being thrown when I try to save a new node is "Token has been used previously for a request"
Why does this come up?
XML-RPC methods/struct to create new node question
I'm trying to create a simple c# app that logs into my drupal site and creates a node, doesn't need to be secure or fancy.
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct DrupalUser
{
// Fields
public string name;
public string email;
}
[XmlRpcMissingMapping(MappingAction.Ignore)]
public struct Drupal
{
public string sessionid;
public DrupalUser user;
}
public struct DrupalNode
{
No permission for views_service module
I encountered another problem that I am assuming has to do with the lack of permissions for views_service.
First, my setup is completely up-to-date.
The problem is that from Flash on my desktop Services doesn't return any results from Views, ie the returned object is blank. When I change to a get a node, it works. The returned object contains all the pertinent information.
Simple use of Services with JSON
I am trying a simple test with Drupal 6, Services, JSON Server but am running into the following error. To make things as simple as possible, I tried this with the curl command line program (although I have also tried it in python and php). I have services and json server installed and can go to services at mysite.com/admin/build/services/browse/service.name and successfully browse a view I made using views.get. I also did this with node.get However (all on the same machine) when I try:
curl --data method=views.get --data view_name="myview" http://mysite/services/json
or
node.save with JSON Server
I am using the services module along with JSON server to create an Adobe Air app.
function send_post(){
obj = new Object;
obj.type = "story";
obj.title = $('#new_post').val();
obj.changed = new Date().getTime();
obj.body = "test";
obj.uid = uid;
obj.nid = "0"
console.log(obj);
$.getJSON(service + "?jsoncallback=?", {method: "node.save", sessid: sessid, node: obj}, function(data){
console.log(data);
listposts();
});
}system.service - take down for maintenance, unload module, load module
Hi - I was wondering if there was a set/get maintenance mode through the services module. Also, the ability to disable and enable modules?
Moving Servers, old flash app now throwing badVersion error
ok, i have 6.10 on the new server, I am running Services 6.x-0.13, AMFPHP 6.x-1.x-dev. My flash apps cannot connect to the new host(now a goDaddy server). I am able to connect to the old host with no issues. I am getting the following error:
unhandled NetStatusEvent: NetConnection.Call.BadVersion. If you have any idea what may be causing this let me know.
I am hoping maybe its a permissions error i have set incorrectly somewhere.
Thanks,
Chris
views.get returns an empty array
My Setup
Drupal 6.10
Services 6.x-1.x-dev
AMFPHP 6.x-1.0-beta1
XMLRPC Server 6.x-1.x-dev
Views Service 6.x-1.x-dev
Views 6.x-2.5
The problem
I set up a view to pull a certain content type out with relevant info. It works great in Views. All of the information is visible when I preview it inside of views. When I try views.get within Services, the result is an empty array. There aren't any error messages. Just an empty array - Array().
What am I doing wrong?
Geo June - Participate!
Help move Drupal a crucial step closer to being a true Geospatial CMS!
The Drupal community and the Twin Cities Drupal Group invites us all for Geo June, a month-long series of events and collaborative projects. There will be coding, documenting and demonstrating solutions for data collection and mapping.
You can join in the fun by helping the issue queue for Geo and related modules, or by participating in other ways:
LA Drupal videos galore (DrupalCampLA + Meetings)
For over a year LA Drupal has been recording our meetings and many of our events. View the videos online... http://drupal-la.blip.tv
Subscribe to our video podcast... http://drupal-la.blip.tv/rss (available directly on iTunes too)
We provide these videos for free for people to learn Drupal of course. Over the next handful of weeks you will see us release videos from our meetings and DrupalCampLA '08. Learn the basics of Drupal, theme design, module development, advanced views, Services module (Flash + Drupal), and many, many more topics all relating to Drupal.
Follow us on twitter... www.twitter.com/ladrupal
Flex: Save binary bytearray data from actionscript 3 to drupal with amfphp
I have been looking for a way to upload a file in flex and save the bytearray directly to drupal via amf. This was written on Drupal 5 however it can easily be added to Drupal 6. Just note there is already a file_services module in D6 and not d5. Here's what I have come up with that works great:
Saving Node with Tagged Taxonomy Values Vocabulary
Hi,
Been looking around a lot of different locations for a possible solution to this. Looked at the solution on this page http://hybridhacking.com/node/27 and have not been able to get this working.
As of right now I am using a CCK Content type with two int fields and 2 taxonomy vocabularies, one named "Sector". Each of these vocabularies is a tagged type of term.
I'm using Flex to create this and when I save the node from Flex, it says that it's successful but there is no change to the terms being displayed.
user.login with persistent login module
Hi, is it possible to do a persistent login from a remote application with user.login combined with the persistent login module?
Views.get is not returning file path from a file field defined in a view.
What I'm using:
Drupal 6.11
Plugin version combos I've tried:
Services 6.x-0.13
Views 6.x-2.5
and
Services 6.x-1.x-dev
Views 6.x-2.x-dev
I've created a node type named Emoticon with a File field type of Image.
Inside the emoticon view, I specified a field which returns the "Path to file" of the emoticon.
When previewing the view inside the View editor the path field is displayed properly.
When calling this view from the Views.get form inside Services I get:
[node_data_field_chat_emoticon_field_chat_emoticon_fid] => 79
Are you using Flex, Flash, or Adobe AIR in your Drupal sites?
Help on Channel disconnected error
I created a profile_service module and exposed a function named profile.save. This is the code:
array(
'#method' => 'profile.save',
'#callback' => 'profile_service_save',
'#args' => array(
array(
'#name' => 'user',
'#type' => 'struct',
'#description' => t('The object that contains the profile data.'))),
'#help' => t('Saves a profile data.')),Here is the callback function:
function profile_service_save($data) {
print_r($temp);
}Accessing functions of other modules
I am creating a sample module that will create a wrapper function of another module. For example, I have a profile_service module (that extends Service module) and would like to exposed an API named profile.get(). Within this function, it will call the user.get() of user_service. I have tried this in code:
function profile_service_get($uid) {
print_r("Calling the function of another module..");
include("../../services/services/user_service.inc");
return user_service_get($uid);
}I'm getting this error:
How to fix "XML-RPC server accepts POST requests only." error?
I tried Services and it methods work, except XML-RPC. Testing XML-RPC with Drupal 6.10 (and 5.16) by click into http://mysite.com/services/xmlrpc I got the following message: "XML-RPC server accepts POST requests only."
How to fix this?
PHP Script for XML-RPC calls from outside Drupal
Here is a set of PHP functions I put together for calling Drupal's core XML-RPC methods without using the Services API:
<?php
function assemble_request($method, $args = array(), $dump_request = FALSE){
$request = xmlrpc_encode_request($method,$args);
$context = stream_context_create(array('http' => array(
'method' => "POST",
'header' => "Content-Type: text/xml",
'content' => $request
)));
if($dump_request){
echo '
<
pre>';
echo htmlentities($request);
browse services -> node.save
Hi,
I'm just starting out with the services stuff - I can follow the load/get of nodes and am quite happy with the screencasts on offer.
On the administration->site building->services->browse page, I'm trying to use the node service node.save - it requires a struct, which I'm guessing is an array but can't get it to work. I keep getting 'node not found'.
Here is what I input into the form: array('type'=>'page','title'=>'test title')
What should I be putting to make it work?
NEW Imgecache service : Triggering the creation of imagecache derivatives programmatically
Hello all,
This service force the creation of an image derivative with imagecache. Just pass the relative url of the image and the name of image cache preset.
The title and code is from Florian Lorétan. Read more from his blog:
http://happypixels.net/blog/triggering-creation-imagecache-derivatives-p...
It was so easy to make a service.
But what im looking for is to create presets on the fly, something like:
Scale (width=160, height=null , upscale: false)
Crop (width= 155, height= 160, xoffset= center, yoffset= center)
Flex: Image snapshot and File save service
i broke my head on this for few days (and broke anyone on this group's b##ls i guess..)
i got to a solution now and want to share:
i am on drupal 6.10, Services, amfphp.
I have a content type called PHOTOS with 1 image_field.
I need to save the image to server, store it into drupal, then finally create/edit the node to link the image file to it.
My starting point is very similar with keystr0k's @ http://groups.drupal.org/node/20549, with the difference that he's using DrupalSite.as class.
I tried keystr0k's method and it didnt work for me, and it was too complex to debug.
DrupalSite and Creating new nodes/updating nodes
I have tried everything i can think of to create a new node using the DrupalSite class from thirdavedesign and nothing works. I can get views, nodes, and other information just fine. However, when i try to login or save a node (new or update) it gives me a fail message(and not any details as to why/how it failed).
search nodes service
I've created a search search service using drupalsite as below:
<?php
public function searchNodes(search_keys:String, callback:Function, data:Object = null, reload:Boolean = false):Boolean {
return startBlocking(callback, data, search_keys, 'search.nodes', search_keys, true);
}
?>if the search is successful it works fine - but when there are no search terms i'm getting php errors in my error log as below:
Module: Transfer Full nodes from a drupal site to another drupal site
Hello All,
I had been working for couple of days on a module that would allow me to transfer nodes from a Drupal Website to another drupal site (for now).
which includes a full node save along with terms,files and CCK extra fields.
its really been a headache since i started patching the method "taxonomy_node_save" in "taxonomy services";
i have done the step of save a node (piece of cake) but now into the terms problem hence the NID of the new transferred node needs to be send to the remote server.
ill keep you updated guys on it and might release a contribution soon.
user.save and profile?
Hello all, this is my first post.
I'm working this the various services and Flex. I can get profile specific info with user.get, but I'm getting an access denied error when I try to save an update to that infomation.
Before I dig to far with this, is the user service supposed to be able to save profile information or would that require a custom module? I've edited the permissions quite a bit and I can't see anything obvious that I haven't already granted.
Just looking for a sanity check.
Thanks,
Derek
Views ans files datas
Hello,
I'm trying to build flash news with text and image, using CCK, Views, Services, AMFPHP and Drupalsite classes in a simple Flash AS3 document.
Everything work's fine except the files name and path.
When I call the views.get method in the Services Browser, I get this :
Array
(
[0] => stdClass Object
(
[nid] => 24
[node_data_field_news2_image_field_news2_image_fid] => 26
[node_data_field_news2_image_field_news2_image_list] => 1
[node_data_field_news2_image_field_news2_image_data] => a:1:{s:11:"description";s:0:"";}
[node_data_field_news2_image_nid] => 24
[node_type] => news2
)
[1] => stdClass Object
(
[nid] => 25
[node_data_field_news2_image_field_news2_image_fid] => 27
[node_data_field_news2_image_field_news2_image_list] => 1
[node_data_field_news2_image_field_news2_image_data] => a:1:{s:11:"description";s:0:"";}
[node_data_field_news2_image_nid] => 25
[node_type] => news2
)
)Flex DrupalSite, Services, and CCK ImageField
Can someone please help me figure out how to use node.save to save a node of a content type containing a CCK ImageField ? Here is the setup:
Flex 3, PHP, Drupal 6, Services (all sub-modules enabled), DrupalSite Flex Framework.
Drupal:
I've got a content type called "Photo" which contains the following fields: Title, Photo (ImageField), and Taxonomy.
Flex:
DrupalSite multiple service calls
Using DrupalSite to connect to services it seems you can only make one service call at a time.
I've made a new service called taxonomy.getTerm in the taxonomy_service.module - this uses taxonomy_get_term() to return a term. I have a need to load multiple terms for each node - so each node that i'm getting in flash uses this service i've made to get all the term data. Unfortunately the BLOCKING method in DrupalSite prevents you running multiple simultaneous service calls.
Is there a good reason for this, if not what's a good work around?
Caching Service Queries (XML-RPC)
In using a CDN to cache pages, but "POST" queries can't be cached. In using "GET" method, the cache network should be able to save the service from its unique url. Is there a way of loading a XML-RPC service using "GET" method, or a different server type I should use?
Currently I built a Flash AS2 app using XML-RPC services. I have to rebuild it now so it can be cached. Please HELP!
Thanks!
-Joe
DrupalSite and menu.get
Okay. I am looking at trying to expand on the ThirdAve drupalSite class so that i can get Menus from drupal to place in my flash version of the site. Is there any documentation on doing this?
So far what I have:
/*
getMenu: Get Drupal Created Menus for use in flash applications. *New AS 3.0 DrupalSite Class Function
*/
public function getMenu(mid:String, callback:Function, data:Object = null, reload:Boolean = false):Boolean
{
if (MENUS[mid] && MENUS[mid] is Object && !reload) {
User Management from within Flash
Hello all! I'm having a little trouble finding detailed resources that explain how to manage users from inside a flash interface. I have a flash app that launches independent of Drupal, meaning the user can either access the flash system through Drupal or simply launch it by visiting a direct link. I want the user to be able to either login through the Drupal site or through the flash interface, so once the user is inside flash I need the system to check:
1) Is the user already logged in?
Services API Documentation
node.save
I had a very tough time finding what arguments were required by node.save... I finally guessed that a new node needed a "created" timestamp argument. Where should I post the following?
For new node creation be sure to set the creation time of the node:
var my_date:Date = new Date();
nodeObject.created = my_date.getTime();and for editing existing nodes, be sure to set the changed time of the node:
var my_date:Date = new Date();
nodeObject.changed = my_date.getTime()Extract data from services:views into flash datagrid, arrays
I'm successfully pulling data from services using views.getView:
var pc:PendingCall = views.getView("courselist");I'm able to populate a datagrid like this:
myDG.dataProvider = re.result;and I can map fields directly to columns in the datagrid.
I am also pulling selected fields when a user selects a row from the data grid:
//Create listener object from recordset
var listListener:Object = new Object();
listListener.change = function(evt_obj:Object) {
selected_dg_txt.text = myDG.selectedItem["title"];
body_txt.htmlText = myDG.selectedItem["body"];
price_txt.text = "$ "+myDG.selectedItem["list_price"];
var created_date = myDG.selectedItem["created"];
};
// Add listener.
myDG.addEventListener("change", listListener);Release - DrupalXmlRpc.Net
Greetings everyone. I just released the first version of my DrupalXmlRpc.Net project at SourceForge.Net and can be found at: http://sourceforge.net/projects/drupalxmlrpc/ .
The framework contains the "footwork" to easily connect to Drupal's XmlRpc Service with minimal amount of code. I hope you find it useful. For more information on it as well as some code snippets, please visit http://www.molinesoftware.com
Services data bloat and potential solutions
Short context: We've been developing apps for the mobile phones (3G, EDGE, etc) and it's clear there's a need to make the data sent to the devices as concise as possible, otherwise it results in a poor user experience because of long loading times due to waiting for the data.
As a result, we've passed on using traditional Drupal methodologies like node_load because functions like that can return a large amount of data, which isn't suitable. Obviously, this isn't a good situation either way.
Services code sprint at Drupalcon DC
The services maintainers will be holding a code sprint on Saturday, March 7 at Drupalcon, as part of the greater code sprint scheduled for that day. I am hoping to take an axe to the issue queue and clean things up there, and I know there will be some discussion of future plans for authentication and oAuth as well. If you will be at Drupalcon and are interested in Services, please come feel free to come by and lend a hand, or hands, on your keyboard :) I'm sure there will be plenty to do.
Service search.nodes and i18n
hi,
I have a multilingual site built with i18n.
When i do a normal search, my site searchs for the nodes with the defined language and it is ok.
But, when i do a search trougth services, using search.nodes, the service returns only the nodes with the main language, the others never show up, even if I change the language.
Is there a way to correct this issue?
or at least, to add a field as argument to look for a specifed language in node's language field?
thanks in advance.
ps:
i posted here also: http://drupal.org/node/382406
Send system paths with swfAddress module
I'm using swfAddress module to manage paths in Flash. I'm having trouble passing the system path.
If i type in an aliased URL like mysite.com/event/event-name i want to tell flash that i'm really looking at mysite.com/node/2
I'm using SWFAddress.getValue in my as3 and that always shows the url as its displayed in the address bar (without the mysite.com bit or the hash - if the hash is present). SWFAddress suggests it can send the alias or system path, but i'm not seeing that. I've tried with and without the Path module and PathAuto turned on.
API like Uniform for Module-2-Module communication
Hi
First, excuse me if theres already some solution for.
I've surfed drupal.org and also the groups but didn't find something...
What I've to do is building a "stack" like Acquia but with advanced functionality.
For this I'll need to grab some already existing Modules and change some of their functions to work "cleaner" with other or mine, too. Because of this it would make updating Core and also Modules a horrobale job I'm looking for a standardize solution to let Modules communicate with each other without bigger modifying.
Alternative to AMFPHP using SabreAMF
This is an alternative module to amfphp for drupal 6, amfphp seems to give people some headaches during last period.
Try it, use it and check the licenses, SabreAMF comes with a different license than drupal.
(also check the as3 samples)
Download the attachment and rename the file from sabreamf.zip_.doc to sabreamf.zip and extract it. Cheers.
I would be glad if someone mirrors it, as it was rejected to enter drupal modules.
In any mean, this is mostly a blatant copy/change of amfphp module to keep compatibility.
Usage is almost the same as using amfphp module.
flash+amfphp+services+drupalSite working in safari and not firefox
I've got a local copy of my site (running on MAMP) that uses flash with the technology and frameworks mentioned in the title working fine on both Firefox and Safari locally. It also works fine locally if I choose the remote path for the gateway url in both browsers ONLY if the site is running locally - but if I upload the swf online it works in Safari but not Firefox.
To recap -
running locally in MAMP at the address http://mysite.dev (localhost/mysite)
gateway URL = http://mysite.dev/services/amfphp/gateway.php
works fine in Firefox and Safari
Getting blank screen for REST response for "get"
I'm new to Drupal so forgive me if this is a noob question. I've set up Drupal 6 and the Services module and the REST Server and the Zend Framework. When I make a REST call, eg. http://mysite/services/rest?method=node.get&nid=1 I get a blank screen. However, if I change the method to node.delete, I get an xml succeess response. And I get an xml error message if I pass an unknown method name.
Services fo Workflow
Hi!
I'm just a newbie in drupal, especially in services.
Although i already used this powerful services_module several times using java application.
I want to know if there's a way to view the data of workflow_module in sevices?
Thanks in advance!!!
java node.save example anywhere?
I have a java client up and running using org.apache.xmlrpc.client.XmlRpcClient as client lib and a current drupal 6 with services via xmlrpc enabled. I already can connect, login, logout and even loading a node works.
Authentication is done via sessionID, API-key is disabled.
Now for the problem: i can't get the node.save to work. I give the function two parameters, the session and some structure. What java type equivalent is there expected?
config.setEnabledForExtensions(true);
...
HashMap<String,Object> hmSave = new HashMap<String,Object>();
hmSave.put("type", "pruefsumme");
hmSave.put("title", ivFileList.get(i));
hmSave.put("field_crc32", ivCheckSumListCRC32.get(i));
params = new Object[] {
sessid,
hmSave
};
Object oSave = client.execute(WS_ACTION_SAVE, params);
System.out.println(WS_ACTION_SAVE + "\t" + oSave);Views 2.x vs Views 1.x with services etc
I'm using the Drupalsite framework (http://thirdavedesign.com/drupalsite/) to connect to view via AMFPHP and Services with Views 2.x (and Drupal 6.x obviously), I've had everything running fine in Views 1 / Drupal 5 and i'm keen to update to Drupal 6.
With Views 1.x (Drupal 5) a view that looked at nodes with images (using imagefield) you got the URL of that image, with Views 2.x everythings a bit different and i'm struggling to get the image info.
To recap this is the set of modules i'm using (that are relevant)
CCK 6.x-2.1
ImageField 6.x-3.0-alpha3
ImageAPI 6.x-1.2
amfphp always returns null
hi,
i have drupal 6 with amfphp and services. i think it is ok, because i don't get any error when i try to connect..but..
my call to amfphp ALWAYS return null...and not even a small warning, no errors...just null.
when i use remote object, the function for result ok is called...just the result comes as null.
what might be happening?
Pb with menu.get and Flash as3
Hi,
from an as3 script i'm calling the menu.get method and i get only items with path = <front>, if i specify a node in the path field i don't get the item (path = node/4).
When i test from Drupal admin/build/services/browse/menu.get with the call method same problem.
Any suggestions ?
services 6.x-0.13
SOAP example message
Hello,
I want to connect my C# application to my drupal site. I would like to do this with SOAP, as I am more familiar with that and I cannot get real insight in the XML-RPC proceeding. Now, there is no example of a SOAP message so far. Does anyone here have a sample raw xml message for me, to get a starting point on that?
many thanks in advace :)
regards,
Philip












