Get Resource Details

Returns resource usage details of the specified organization.

REQUEST URI

https://<ZohoAnalytics_Server_URI>/restapi/v2/resources

Get

oauthscope: ZohoAnalytics.usermanagement.read

POSSIBLE ERROR CODES

7301

Sample Request:

Copiedcurl https://analyticsapi.zoho.com/restapi/v2/resourceDetails
-H 'ZANALYTICS-ORGID: <org-id>' 
-H 'Authorization: Zoho-oauthtoken <access_token>'
Copiedusing System;
using System.Collections.Generic;
using ZohoAnalytics;

namespace ZohoAnalyticsTest
{
    class Program
    {
        long orgId = 55522777;

        public void GetResourceDetails(IAnalyticsClient ac)
        {
            IOrgAPI org = ac.GetOrgInstance(orgId);
            JsonElement resourceInfo = org.GetResourceDetails();
            Console.WriteLine(resourceInfo);
        }

        static void Main(string[] args)
        {
            string clientId = "1000.xxxxxxx";
            string clientSecret = "xxxxxxx";
            string refreshToken = "1000.xxxxxxx.xxxxxxx";

            try
            {
                IAnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);
                Program obj = new Program();
                obj.GetResourceDetails(ac);
            }
            catch (ServerException ex)
            {
                Console.WriteLine("Server exception - " + ex.GetErrorMessage());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Other exception - " + ex.Message);
            }
        }
    }
}
Copiedpackage main

import (
    "fmt"
    ZAnalytics "zoho/pkg/analyticsclient"
)

var(
    clientId = "1000.xxxxxxx"
    clientSecret = "xxxxxxx"
    refreshToken = "1000.xxxxxxx.xxxxxxx"

    orgId = "55522777"
)

func GetResourceDetails(ac ZAnalytics.Client) {
    org := ZAnalytics.GetOrgInstance(&ac, orgId)
    result, exception := org.GetResourceDetails()
    
    if(exception != nil){
        fmt.Println(exception.ErrorMessage)
    }else{
        fmt.Println(result)
    }
}

func main() {

    ac := ZAnalytics.GetAnalyticsClient(clientId, clientSecret, refreshToken)
    GetResourceDetails(ac)

}
Copiedimport com.zoho.analytics.client.*;
import org.json.*;

public class Test {

    private long orgId = 55522777l;

    public static void main(String args[]){

        String clientId = "1000.xxxxxxx";
        String clientSecret = "xxxxxxx";
        String refreshToken = "1000.xxxxxxx.xxxxxxx";

        Test tObj = new Test();
        AnalyticsClient ac = new AnalyticsClient(clientId, clientSecret, refreshToken);

        try {
            tObj.getResourceDetails(ac);
        }
        catch (ServerException ex) {
            System.out.println("Server exception - ErrorCode : " + ex.getErrorCode() + ", ErrorMessage : "  + ex.getErrorMessage());
        }
        catch (ParseException ex) {
            System.out.println("Parser exception - ErrorMessage : "  + ex.getResponseMessage());
        }
        catch (Exception ex) {
            System.out.println("Other exception - ");
            ex.printStackTrace();
        }
    }

    public void getResourceDetails(AnalyticsClient ac) throws Exception {
        OrgAPI org = ac.getOrgInstance(orgId);
        JSONArray result = org.getResourceDetails();
        System.out.println(result);
    }
}
Copied<?php

    require 'AnalyticsClient.php';

    class Test
    {
        public $ac = NULL;
        public $client_id = "1000.xxxxxxx";
        public $client_secret = "xxxxxxx";
        public $refresh_token = "1000.xxxxxxx.xxxxxxx";

        public $org_id = "55522777";

        function __construct() {
            $this->ac =  new AnalyticsClient($this->client_id, $this->client_secret, $this->refresh_token);
        }

        function getResourceDetails() {
            $org = $this->ac->getOrgInstance($this->org_id);
            $response = $org->getResourceDetails();
            print_r($response);
        }
    }

    $test_obj = new Test();

    try {
        $test_obj->getResourceDetails();
    }
    catch(ServerException $se) {
        echo "Server exception : " . $se->getErrorMessage() . "\n";
    }
    catch(IOException $ioe) {
        echo "IO exception : " . $ioe->getErrorMessage() . "\n";
    }
    catch(ParseException $pe) {
        echo "Parser exception : " . $pe->getErrorMessage() . "\n";
    }
    catch(Exception $e) {
        echo "Exception : " . $e->getErrorMessage() . "\n";
    }
?>
Copiedfrom __future__ import with_statement
from AnalyticsClient import AnalyticsClient
import sys
import json

class Config:

    CLIENTID = "1000.xxxxxxx";
    CLIENTSECRET = "xxxxxxx";
    REFRESHTOKEN = "1000.xxxxxxx.xxxxxxx";

    ORGID = "55522777";

class sample:

    ac = AnalyticsClient(Config.CLIENTID, Config.CLIENTSECRET, Config.REFRESHTOKEN)

    def get_resource_details(self, ac):
        org = ac.get_org_instance(Config.ORGID)
        result = org.get_resource_details()
        print(result)

try:
    obj = sample()
    obj.get_resource_details(obj.ac);

except Exception as e:
    print(str(e))
Copiedvar analyticsClient = require('./AnalyticsClient');

var clientId = '1000.xxxxxxx';
var clientSecret = 'xxxxxxx';
var refreshtoken = '1000.xxxxxxx.xxxxxxx';
var orgId = '55522777';

var ac = new analyticsClient(clientId, clientSecret, refreshtoken);

var org = ac.getOrgInstance(orgId);
org.getResourceDetails().then((response) => {
    console.log(response);

}).catch((error) => {
    console.log('errorCode : '+error.errorCode);
    console.log('errorMessage : '+error.errorMessage);
});
CopiedorgId = "55522777";

headersMap = Map();
headersMap.put("ZANALYTICS-ORGID",orgId);

response = invokeurl
[
  url :"https://analyticsapi.zoho.com/restapi/v2/resources"
  type :GET
  headers:headersMap
  connection:"analytics_oauth_connection"
];
info response;

Download SDK : C# | GO | JAVA | PHP | PYTHON | NodeJS

Sample Response:

CopiedHTTP/1.1 200 OK
Content-Type:application/json;charset=UTF-8

{
    "status": "success",
    "summary": "Get resource details",
    "data": {
        "resourceDetails": [
            {
                "resourceName": "users",
                "resourceUsage": {
                    "allocated": "15",
                    "used": "15",
                    "remaining": "0",
                    "remarks": ""
                }
            },
            {
                "resourceName": "roUsers",
                "resourceUsage": {
                    "allocated": "25",
                    "used": "1",
                    "remaining": "24",
                    "remarks": ""
                }
            },
            {
                "resourceName": "workspaces",
                "resourceUsage": {
                    "allocated": "Unlimited",
                    "used": "69",
                    "remaining": "Unlimited",
                    "remarks": ""
                }
            },
            {
                "resourceName": "rows",
                "resourceUsage": {
                    "allocated": "5000000000",
                    "used": "2258717",
                    "remaining": "4997741283",
                    "remarks": ""
                }
            },
            {
                "resourceName": "queryTables",
                "resourceUsage": {
                    "allocated": "Unlimited",
                    "used": "29",
                    "remaining": "Unlimited",
                    "remarks": ""
                }
            },
            {
                "resourceName": "scheduledImports",
                "resourceUsage": {
                    "allocated": "Unlimited",
                    "used": "53",
                    "remaining": "Unlimited",
                    "remarks": ""
                }
            },
            {
                "resourceName": "scheduledEmails",
                "resourceUsage": {
                    "allocated": "30",
                    "used": "0",
                    "remaining": "30",
                    "remarks": ""
                }
            },
            {
                "resourceName": "apiUnits",
                "resourceUsage": {
                    "allocated": "300000",
                    "used": "71.4",
                    "remaining": "299928.6",
                    "remarks": ""
                }
            },
            {
                "resourceName": "scheduledAlerts",
                "resourceUsage": {
                    "allocated": "30",
                    "used": "0",
                    "remaining": "30",
                    "remarks": ""
                }
            },
            {
                "resourceName": "scheduledSnapshots",
                "resourceUsage": {
                    "allocated": "0",
                    "used": "0",
                    "remaining": "0",
                    "remarks": ""
                }
            },
            {
                "resourceName": "financeMultiorgImports",
                "resourceUsage": {
                    "allocated": "25",
                    "used": "0",
                    "remaining": "25",
                    "remarks": ""
                }
            },
            {
                "resourceName": "privateLinks",
                "resourceUsage": {
                    "allocated": "Unlimited",
                    "used": "1",
                    "remaining": "Unlimited",
                    "remarks": ""
                }
            }
        ]
    }
}