API Reference

System.multicall

This method allows you to wrap multiple methodcalls in one service request. This method is compatible with the XML-RPC multicall specification.

Every request should be struct with a "methodName" and a "params" key. The "params" array may not be an associative array, it must be anindexed array. This means that you must provide each parameter in its correct order to the services you are calling.

An example of the REST request syntax is below.

Sample JSON Multical Request

var params = {
    "method" : 'system.multicall',
    "requests" : [{
        "methodName" : "media.getFiles",
        "params" : {
            "vhost" : [VHOST_ID],
            "sort"  : "",
            "filters" : {
                "channel" : [CHANNEL_ID]
            },
            "start" : "",
            "limit" : 2
        }
    },
    {
        "methodName" : "users.getUsers",
        "params" : {
            "vhost" : [VHOST_ID],
            "filters" : {
                "active" : "true"
            },
            "offset" : "",
            "limit" : "10",
            "fields" : ["firstname","lastname","email"],
            "sort" : "created DESC",
            "getExternalIds" : ""
        }
    },
    {
        "methodName" : "groups.createGroup",
        "params" : {
            "vhost" : [VHOST_ID],
            "name" : "New Group Name",
            "additionalInfo" : {
                "email" : "[USER_EMAIL_ADDRESS_REQUIRED]"
            }
        }
    }],
    "APIKEY" : "[APIKEY]"
}

$.post('/services/json',params
,function(response){
    console.log(response);
});


Syntax

array system.multicall ( array requests )

Arguments

NameTypeRequiredDefault valueDescription
requestsarrayRequirednoneThis is an array of service calls that are going to be made using the multicall service.

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/system/multicall?
requests[0][methodName]=media.getFiles&
    requests[0][params][vhost]=[VHOST_ID]&
    requests[0][params][sort]=&
    requests[0][params][filters][channel]=[CHANNEL_ID]&
    requests[0][params][start]=&
    requests[0][params][limit]=2&
requests[1][methodName]=users.getUsers&
    requests[1][params][vhost]=[VHOST_ID]&
requests[2][methodName]=groups.createGroup&
    requests[2][params][vhost]=[VHOST_ID]&
    requests[2][params][name]=[NEW_GROUP_NAME]&
    requests[2][params][additionalInfo][email]=[USER_EMAIL_ADDRESS]&
APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <item>
    <item>
      <totalCount>2</totalCount>
      <data>
        <item>
          <avatar>0</avatar>
          <channel>CHANNEL_ID</channel>
          <commentcount>0</commentcount>
          <filetype>1</filetype>
          <hits>47</hits>
          <id>MEDIA_ID</id>
          <message>MEDIA_DESCRIPTION</message>
          <rating>0</rating>
          <status>3</status>
          <tags>these are media tags</tags>
          <title>MEDIA_TITLE</title>
          <uid>USER_ID</uid>
          <upload>2012-01-25 16:36:47</upload>
          <user_name>USER_NAME</user_name>
          <vhost>VHOST_ID</vhost>
          <votecount>0</votecount>
          <publicUrl>http://fmdevs3.filemobile.com/storage/MEDIA_ID</publicUrl>
          <thumbUrl>http://fmdev.s3.amazonaws.com/storage/MEDIA_ID</thumbUrl>
          <location>fmdevs3</location>
        </item>
        <item>
          <avatar>0</avatar>
          <channel>CHANNEL_ID</channel>
          <commentcount>0</commentcount>
          <filetype>4</filetype>
          <hits>0</hits>
          <id>MEDIA_ID</id>
          <message>
            <p>
This is some test text</p>
          </message>
          <rating>0</rating>
          <status>3</status>
          <tags>media test text example</tags>
          <title>MEDIA_TITLE</title>
          <uid>USER_ID</uid>
          <upload>2012-01-24 15:21:52</upload>
          <user_name>USER_NAME</user_name>
          <vhost>VHOST_ID</vhost>
          <votecount>0</votecount>
          <publicUrl>http://fmdevs3.filemobile.com/storage/MEDIA_ID</publicUrl>
          <thumbUrl>http://fmdev.s3.amazonaws.com/storage/MEDIA_ID</thumbUrl>
          <location>fmdevs3</location>
        </item>
      </data>
      <vhost>VHOST_ID</vhost>
    </item>
  </item>
  <item>
    <item>
      <totalCount>3</totalCount>
      <data>
        <item>
          <id>USER_ID</id>
          <firstname>USER_FIRSTNAME</firstname>
          <lastname>USER_FIRSTNAME</lastname>
          <city/>
          <country/>
          <avatar>0</avatar>
          <email>USER_EMAIL_ADDRESS</email>
          <user>USER_NAME</user>
          <gender/>
          <offset>0</offset>
        </item>
        <item>
          <id>USER_ID</id>
          <firstname/>
          <lastname/>
          <city/>
          <country/>
          <avatar>0</avatar>
          <email>USER_EMAIL_ADDRESS</email>
          <user>USER_NAME</user>
          <gender/>
          <offset>1</offset>
        </item>
      </data>
    </item>
  </item>
  <item>
    <item>GROUP_ID</item>
  </item>
</result>
Sample JSON Response
{
    "status": true,
    "result": [
        [
            {
                "totalCount": "2",
                "data": [
                    {
                        "avatar": "0",
                        "channel": CHANNEL_ID,
                        "commentcount": 0,
                        "filetype": 1,
                        "hits": 49,
                        "id": MEDIA_ID,
                        "message": "Media Example Test Upload YEYEY UPDATE",
                        "rating": 0,
                        "status": 3,
                        "tags": "media example test upload",
                        "title": "Image Example",
                        "uid": USER_ID,
                        "upload": "2012-01-25 16:36:47",
                        "user_name": "USER_NAME",
                        "vhost": VHOST_ID,
                        "votecount": 0,
                        "publicUrl": "http://fmdevs3.filemobile.com/storage/MEDIA_ID",
                        "thumbUrl": "http://fmdev.s3.amazonaws.com/storage/MEDIA_ID",
                        "location": "fmdevs3"
                    },
                    {
                        "avatar": "0",
                        "channel": CHANNEL_ID,
                        "commentcount": 0,
                        "filetype": 4,
                        "hits": 0,
                        "id": MEDIA_ID,
                        "message": "

\r\n\tThis is some test text media

\r\n", "rating": 0, "status": 3, "tags": "media test text example", "title": "Test text media", "uid": USER_ID, "upload": "2012-01-24 15:21:52", "user_name": "USER_NAME", "vhost": VHOST_ID, "votecount": 0, "publicUrl": "http://fmdevs3.filemobile.com/storage/MEDIA_ID", "thumbUrl": "http://fmdev.s3.amazonaws.com/storage/MEDIA_ID", "location": "fmdevs3" } ], "vhost": VHOST_ID } ], [ { "totalCount": "1", "data": [ { "firstname": "USER_FIRSTNAME", "lastname": "USER_LASTNAME", "email": "USER_EMAIL_ADDRESS", "offset": 0 }, { "firstname": "USER_FIRSTNAME", "lastname": "USER_LASTNAME", "email": "USER_EMAIL_ADDRESS", "offset": 1 } ] } ], [ "NEW_GROUP_ID" ] ] }

Code examples

0 comments

Be the first to comment on multicall.

Add a Comment

  • captcha