Posted in: Orbit

GVOrbit Alarm REST API接口文档

GVOrbit Alarm REST API

API和SDK文档

版本:1.0.0

翻译/校对 :Nick Wang @ 15Jan2021


AlarmAPI通过REST提供对GVOrbit监视数据的访问。使用报警通用数据模型(CDMA)来呈现监视数据。该模型提供了所有Grass Valley设备的当前状态,包括IQ,Densite,Multi-Viewers等。

本文档定义了用于访问此数据的端点,包括输入和输出数据类型。

这是一个OpenAPI 3.0文档,因此可用于自动生成HTML文档以及客户端和服务端API。本文档的规范形式是YAML文件。

当前API使用HTTP未加密方式进行调用,因此需要考虑仅在系统内使用。AlarmAPI服务具有关闭入站报警的选项,实质上是提供对数据的只读访问。

该API支持:报警查询,使用推(push)或拉(pull)报警通知;创建,更新和删除报警,在发布者处于非活动状态时自动删除过时的报警

在GV Orbit系统中,报警根据设备(有时称为单元)分组到集合中。设备可以是物理的(例如,模块板卡),也可以是虚拟的(例如,分类报警)。

要获取所有设备的列表,请使用/devices端点。设备由路径标识,该路径可以是虚拟Linux样式的文件系统路径(通常在Densite / iControl设备上)或NNNN:UU:PP形式的RollCall地址。RollCall地址具有内置的逻辑路径,因此可以解析为网络中的路径。

当前使用的这种识别方法正在复核中,后续可能会更改来进一步标准化RollCall /Densite标识符。

每个设备都可能有多个报警。一旦知道设备的路径,就可以使用/alarms端点通过设备路径来获取报警。

通知支持使用“推”(push)或“拉”(pull)方式。无论哪种方式,客户端都需要创建订阅,服务器会将事件推送到客户端提供的URL,或者客户端可以从服务器拉取数据, 两种方式都可以使用参数来过滤接口数据。在这两种情况下,服务器都会跟踪每个订阅的更改,因此避免多次传递相同的数据。客户端完成订阅后,应删除该订阅,以避免消耗服务器资源。但是,为了防止对客户端进行非正常的清理,如果订阅处于非活动状态达60秒钟,则服务器将自动删除该订阅,因此调用delete的要求并不严格。

在没有数据流(可能有过滤器)并且配置了“推”(push)的情况下,服务器将在至少60秒内向客户端发送一个空事件数组,以测试其有效性,然后再删除订阅。如果连接失败,将最多尝试3次尝试,然后自动删除订阅。为了进一步确保在不通知客户端的情况下不删除订阅,客户端应使用GET /subscriptions端点测试订阅是否有效。这样可以防止服务器与客户端失去联系,从而在客户端不知道的情况下删除推送订阅。

可以通过POST /alarms端点在系统中创建报警。但是,在创建报警之前,客户端首先要按GUID形式注册发布ID,然后应将其插入每个报警的“来源”(origin)字段中。服务器将拒绝任何没有有效发布ID的报警创建尝试。这种方法的优点是它促成了一种即发即弃的方法,在这种方法中,客户端可以发布报警,并确保GV监控系统可以检测到该客户端何时消失,从而清理并标记该设备为丢失设备。

注意:客户端无需单独创建设备为阶段,只需创建一个报警就足以自动创建该设备。

默认

createPublisher

创建报警发布者

发布者是一种资源,它标识使用此API在GV Orbit监看系统内创建报警的任何人。创建发布者后,这允许发布者发布报警。客户必须确保在创建发布者时发送的ID与CDMA报警的“来源”(origin)字段匹配。在将报警添加到监视系统之前,服务器会对此进行验证。客户可以自己选择发布ID(origin)值。使用GUID是明智的选择。如果系统中已经存在一个现有ID,则将对名称进行比较,如果名称不同,则系统将返回错误。如果名称匹配,将返回201。

除非要更新的报警具有与新更新相同的发布ID,否则服务器将阻止报警更新。

最后,服务器跟踪发布ID的使用情况,以检测非存活客户端。客户有责任通过发布更改或调用keepalive端点来保持发布存活信息。在{60}秒之后,如果没有看到发布ID,服务器将删除其创建的报警并将所有设备标记为“丢失的设备”。

PUT方法

/publishers

用法和SDK示例

  • Curl
curl -X PUT\
 -H "Accept: application/json"\
 -H "Content-Type: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/publishers"
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        Publication publication = ; // Publication | 

        try {
            apiInstance.createPublisher(publication);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#createPublisher");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        Publication publication = ; // Publication | 

        try {
            apiInstance.createPublisher(publication);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#createPublisher");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
Publication *publication = ; //  (optional)

// Creates an alarm publisher. 

[apiInstance createPublisherWith:publication
              completionHandler: ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var opts = {
  'publication':  // {Publication} 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.createPublisher(opts, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class createPublisherExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var publication = new Publication(); // Publication |  (optional) 

            try {
                // Creates an alarm publisher. 

                apiInstance.createPublisher(publication);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.createPublisher: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$publication = ; // Publication | 

try {
    $api_instance->createPublisher($publication);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->createPublisher: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $publication = WWW::OPenAPIClient::Object::Publication->new(); # Publication | 

eval { 
    $api_instance->createPublisher(publication => $publication);
};
if ($@) {
    warn "Exception when calling DefaultApi->createPublisher: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
publication =  # Publication |  (optional)

try: 
    # Creates an alarm publisher. 

    api_instance.create_publisher(publication=publication)
except ApiException as e:
    print("Exception when calling DefaultApi->createPublisher: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let publication = ; // Publication

    let mut context = DefaultApi::Context::default();
    let result = client.createPublisher(publication, &context).wait();

    println!("{:?}", result);
}

范围

参数
主体参数
名称描述
publication(发布)此发布者的唯一识别,包括两个字段。origin(来源)应该是GUID,name(名称)只是一些不透明的信息,用作GUID的辅助验证。
{
origin: 发布者的UUID(示例:123e4567-e89b-12d3-a456-426614174000)
# 类型:字符串
name:   标识发布者的某些名称(示例:Blaze视频处理)
# 必填
# 类型:字符串
}

示例:

{
    "origin": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Blaze Video Processing"
}
返回值
  • 状态:201-发布已创建。
  • 状态:403-服务器上的写访问权限被禁用。
  • 状态:400-错误的请求-缺少正文。

示例:该请求缺少正文中的发布信息。(The request was missing the publication information from the body.)

  • 状态:401-未经身份验证。

createSubscriber

创建事件订阅。

创建报警事件的订阅。该端点返回一个会话ID,该会话ID可用于请求更改。此操作返回一个订阅ID(64个字符的GUID),该ID应该在后续的订阅操作中使用,例如拉(pull),删除(delete)或验证(verify)。

PUT方法

/subscribers

用法和SDK示例

  • Curl
curl -X PUT\
 -H "Accept: application/json"\
 -H "Content-Type: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/subscribers"
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        Subscription subscription = ; // Subscription | 

        try {
            UUID result = apiInstance.createSubscriber(subscription);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#createSubscriber");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        Subscription subscription = ; // Subscription | 

        try {
            UUID result = apiInstance.createSubscriber(subscription);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#createSubscriber");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
Subscription *subscription = ; //  (optional)

// Creates a subscription for events. 

[apiInstance createSubscriberWith:subscription
              completionHandler: ^(UUID output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var opts = {
  'subscription':  // {Subscription} 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.createSubscriber(opts, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class createSubscriberExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var subscription = new Subscription(); // Subscription |  (optional) 

            try {
                // Creates a subscription for events. 

                UUID result = apiInstance.createSubscriber(subscription);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.createSubscriber: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$subscription = ; // Subscription | 

try {
    $result = $api_instance->createSubscriber($subscription);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->createSubscriber: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $subscription = WWW::OPenAPIClient::Object::Subscription->new(); # Subscription | 

eval { 
    my $result = $api_instance->createSubscriber(subscription => $subscription);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->createSubscriber: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
subscription =  # Subscription |  (optional)

try: 
    # Creates a subscription for events. 

    api_response = api_instance.create_subscriber(subscription=subscription)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->createSubscriber: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let subscription = ; // Subscription

    let mut context = DefaultApi::Context::default();
    let result = client.createSubscriber(subscription, &context).wait();

    println!("{:?}", result);
}

范围

参数
正文参数
名称描述
Subscription(订阅)客户端感兴趣的设备ID(路径)的数组。如果该数组为空,则将向订阅者交付所有内容。
{
type: “push”或“pull”。具体取决于客户端希望接收通知的方式。(示例:push)
# 必填 
# 类型:字符串
url: 服务器发送事件的回调URL。(示例:http://192.168.15.2/my_app/alarm_handler)
# 类型:字符串
# 仅type设置为“ push”时必须, 发送到此url的数据将是一个Event对象,包含一个Event Items列表。
# 在type设置为“pull”时不需要设置,因为此时客户端负责通过通知/拉动端点拉动更改。 

filter: 
[
# 当返回更改给客户端时服务器使用的用来过滤报警信息一个报警信息数组。当空数组时将交付所有内容。
 {
# 设备的唯一标识符
path: 报警设备的唯一标识符。(示例:11704080)
# 必填
# 类型: string
# 对于IQ设备,这将是RollCall地址。
# 对于Densite板卡,这将是虚拟Linux样式的文件夹路径。
# 第三方可以使用以上任何一种方法。该路径用于将多个报警分组在一个公共文件夹下,并在Orbit中用于显示网络树中的项目。

示例:
{
    "path": "11704080",
    "name": "POWER_USAGE"
}
]

示例:

{
    "filter": [
        {
            "path": "A000:01:02"
        },
        {
            "path": "A000:02:03"
        }
    ],
    "type": "push",
    "url": "http://192.168.15.2/my_app/alarm_handler"
}
返回值
  • 状态:200-订阅ID。应该在后续请求中使用它。

类型: 字符串 (uuid), 示例:7ce05a50-e8ec-4c1d-adfe-4677f8d22965


deletePublisher

删除报警发布者。

从服务器中删除发布,并删除使用该发布ID创建的所有报警。

DELETE方法

/publishers

用法和SDK示例

  • Curl
curl -X DELETE\
 "http://gv-orbit-server:9099/alarmapi/v1/publishers?publicationId="
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        String publicationId = publicationId_example; // String | The publication id of the publisher to delete

        try {
            apiInstance.deletePublisher(publicationId);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#deletePublisher");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String publicationId = publicationId_example; // String | The publication id of the publisher to delete

        try {
            apiInstance.deletePublisher(publicationId);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#deletePublisher");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *publicationId = publicationId_example; // The publication id of the publisher to delete (default to null)

// Deletes an alarm publisher.
[apiInstance deletePublisherWith:publicationId
              completionHandler: ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var publicationId = publicationId_example; // {String} The publication id of the publisher to delete

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.deletePublisher(publicationId, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class deletePublisherExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var publicationId = publicationId_example;  // String | The publication id of the publisher to delete (default to null)

            try {
                // Deletes an alarm publisher.
                apiInstance.deletePublisher(publicationId);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.deletePublisher: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$publicationId = publicationId_example; // String | The publication id of the publisher to delete

try {
    $api_instance->deletePublisher($publicationId);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->deletePublisher: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $publicationId = publicationId_example; # String | The publication id of the publisher to delete

eval { 
    $api_instance->deletePublisher(publicationId => $publicationId);
};
if ($@) {
    warn "Exception when calling DefaultApi->deletePublisher: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
publicationId = publicationId_example # String | The publication id of the publisher to delete (default to null)

try: 
    # Deletes an alarm publisher.
    api_instance.delete_publisher(publicationId)
except ApiException as e:
    print("Exception when calling DefaultApi->deletePublisher: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let publicationId = publicationId_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.deletePublisher(publicationId, &context).wait();

    println!("{:?}", result);
}

范围

参数
查询参数
名称描述
publicationId *要删除的发布者的发布ID(必须,字符串)
返回值
  • 状态:204-发布已成功删除。
  • 状态:403-服务器上的写访问权限被禁用。
  • 状态:404-找不到出版物。

deleteSubscriber

删除订阅者。

删除报警事件的订阅。服务器将不再跟踪此订阅ID的更改。

DELETE方法

/subscribers

用法和SDK示例

  • Curl
curl -X DELETE\
 "http://gv-orbit-server:9099/alarmapi/v1/subscribers?subscriptionId="
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        String subscriptionId = subscriptionId_example; // String | The subscription id of the subscriber to delete

        try {
            apiInstance.deleteSubscriber(subscriptionId);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#deleteSubscriber");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String subscriptionId = subscriptionId_example; // String | The subscription id of the subscriber to delete

        try {
            apiInstance.deleteSubscriber(subscriptionId);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#deleteSubscriber");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *subscriptionId = subscriptionId_example; // The subscription id of the subscriber to delete (default to null)

// Deletes a subscriber.
[apiInstance deleteSubscriberWith:subscriptionId
              completionHandler: ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var subscriptionId = subscriptionId_example; // {String} The subscription id of the subscriber to delete

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.deleteSubscriber(subscriptionId, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class deleteSubscriberExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var subscriptionId = subscriptionId_example;  // String | The subscription id of the subscriber to delete (default to null)

            try {
                // Deletes a subscriber.
                apiInstance.deleteSubscriber(subscriptionId);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.deleteSubscriber: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$subscriptionId = subscriptionId_example; // String | The subscription id of the subscriber to delete

try {
    $api_instance->deleteSubscriber($subscriptionId);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->deleteSubscriber: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $subscriptionId = subscriptionId_example; # String | The subscription id of the subscriber to delete

eval { 
    $api_instance->deleteSubscriber(subscriptionId => $subscriptionId);
};
if ($@) {
    warn "Exception when calling DefaultApi->deleteSubscriber: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
subscriptionId = subscriptionId_example # String | The subscription id of the subscriber to delete (default to null)

try: 
    # Deletes a subscriber.
    api_instance.delete_subscriber(subscriptionId)
except ApiException as e:
    print("Exception when calling DefaultApi->deleteSubscriber: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let subscriptionId = subscriptionId_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.deleteSubscriber(subscriptionId, &context).wait();

    println!("{:?}", result);
}

范围

参数
查询参数
名称描述
subscriptionId *要删除的订阅者的订阅ID(必须,类型:字符串)
返回值
  • 状态:204-订阅已成功删除。
  • 状态:401-未经身份验证。
  • 状态:403-服务器上的写访问权限被禁用。
  • 状态:404-找不到订阅ID。

getAlarmChanges

获取某个订阅自上次轮询以来的所有报警更改。

给定订阅ID,返回所有报警更改的列表。自上次请求以来的添加,删除和更新。服务器将跟踪每个订阅的所有更改,因此将仅交付客户端以前未见的更改。同样,如果客户端不进行轮询(可能正在处理项目),则服务器将跟踪更改并在下一次轮询调用时立即将其交付。此方法使用长轮询技术,如果没有数据,将阻塞最多30秒钟,此后它将返回http201。然后,客户端应立即重新连接以进行进一步更新。注意:长轮询的一种响应更快的替代方式是在服务器将发送更改的位置配置推送通知URL。

GET方法

/alarms/changes

用法和SDK示例

  • Curl
curl -X GET\
 -H "Accept: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/alarms/changes?subscriptionId="
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        String subscriptionId = subscriptionId_example; // String | The subscription id obtained from the call to subscribe.

        try {
            Events result = apiInstance.getAlarmChanges(subscriptionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getAlarmChanges");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String subscriptionId = subscriptionId_example; // String | The subscription id obtained from the call to subscribe.

        try {
            Events result = apiInstance.getAlarmChanges(subscriptionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getAlarmChanges");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *subscriptionId = subscriptionId_example; // The subscription id obtained from the call to subscribe. (default to null)

// Gets all alarm changes for a subscription since the last poll.
[apiInstance getAlarmChangesWith:subscriptionId
              completionHandler: ^(Events output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var subscriptionId = subscriptionId_example; // {String} The subscription id obtained from the call to subscribe.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getAlarmChanges(subscriptionId, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class getAlarmChangesExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var subscriptionId = subscriptionId_example;  // String | The subscription id obtained from the call to subscribe. (default to null)

            try {
                // Gets all alarm changes for a subscription since the last poll.
                Events result = apiInstance.getAlarmChanges(subscriptionId);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.getAlarmChanges: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$subscriptionId = subscriptionId_example; // String | The subscription id obtained from the call to subscribe.

try {
    $result = $api_instance->getAlarmChanges($subscriptionId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getAlarmChanges: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $subscriptionId = subscriptionId_example; # String | The subscription id obtained from the call to subscribe.

eval { 
    my $result = $api_instance->getAlarmChanges(subscriptionId => $subscriptionId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->getAlarmChanges: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
subscriptionId = subscriptionId_example # String | The subscription id obtained from the call to subscribe. (default to null)

try: 
    # Gets all alarm changes for a subscription since the last poll.
    api_response = api_instance.get_alarm_changes(subscriptionId)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->getAlarmChanges: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let subscriptionId = subscriptionId_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.getAlarmChanges(subscriptionId, &context).wait();

    println!("{:?}", result);
}

范围

参数
查询参数
名称描述
subscriptionId *从订阅呼叫获得的订阅ID。(类型:字符串)
返回值

状态:200-包含当前报警快照的报警对象数组。

{
# 订阅警报通知时使用事件对象。自上次读取或推送以来发生的所有事件项目的此对象列表。
# 这允许将多个事件一起收集到单个数据包中。

items: [
        # 提供事件项列表。

            {
            # 根据是更新还是删除事件来包装报警或报警ID。事件项将按照它们在系统中发生的顺序进行传递。

            update: {
                    # ID和state必填
                    # 报警对象提供监视系统内某个报警的状态。
                    # 报警包含在可能是虚拟的或代表物理设备的设备(有时称为单元)内。
                    # 报警可用于指示错误,也可用于记录有关设备的信息。
                    # 虚拟报警可能来自其他报警。
                    ID: {
                        # 某个报警的唯一标识符
                        # name和path必填
                        path: 报警设备的唯一标识符。(示例:11704080)  
                            # 类型:字符串
                            # 对于IQ设备,这将是RollCall地址
                            # 对于Densite报警,这将是虚拟Linux样式的文件夹路径
                            # 第三方可以使用任何一种方法。该路径用于将多个报警分组在一个公共文件夹下,并在Orbit中用于显示网络树中的项目
                        name: 报警的名称。(示例:POWER_USAGE)
                        # 注意:path+name是报警的唯一键
                        示例:
                        {
                            "path": "11704080",
                            "名称": "POWER_USAGE"
                        }
                    origin: 用作警报的父标识符。(示例:S00000102)    
                        # 类型:字符串
                        # 物理警报采用原始设备的序列号
                        # 虚拟警报不会使用此字段
                    state: {
                        # 获取某个报警的当前状态
                        # state和timestamp必填
                        state: 某个报警的当前状态。(示例:ok)
                            # 类型:字符串
                            # 有效值为: "nostate","ok","warn","caution","fail",其中fail最严重
                        latchedState: 当前报警的闩锁状态 (示例:ok)
                            # 类型:字符串
                            # 由于用户重置了闩锁,该报警处于最差的状态
                            # 允许在报警变绿之前短暂地出错。
                        unmaskedState: 当前报警屏蔽状态(示例:ok)
                            # 类型:字符串
                            # 如果屏蔽了报警,则其状态将被抑制,状态字段将变为"nostate"
                            # 如果未应用屏蔽,则该字段将捕获状态。
                        timestamp: 报警的时间戳(示例:2020-01-28T09:12:33.001Z)
                            # 类型:字符串 (date-time)
                        value: 警报的值(或文本)内容(示例:84.5 LU)
                            # 类型:字符串
                        masked: 标志警报被屏蔽,警报状态被抑制 
                            # 类型:布尔值
                        inverted: 标志报警已反转   
                            # 类型:布尔值
                            # 警报倒置时,"ok"倒置为和"fail"和"warn"一样,"caution"和"fail"倒置为和"ok"一样。
                        acked: 如果警报已被用户确认,则为True    
                            # 类型:布尔值
                        ackedTimestamp:确认警报的时间戳 
                            # 类型:字符串 (date-time)
                        ackedBy:确认警报的用户(或主机)的名称。
                            # 类型:字符串
                        示例:
                        {
                            "acked": false,
                            "ackedBy": "",
                            "unmaskedState": "ok",
                            "ackedTimestamp": "",
                            "state": "ok",
                            "masked": false,
                            "latchedState": "ok",
                            "value": "84.5 LU",
                            "inverted": false,
                            "timestamp": "2020-01-28T09:12:33.001Z"
                        }
                    示例:
                    {
                        "origin": "S00000102",
                        "id": {
                                "path": "11704080",
                                "name": "POWER_USAGE"
                            },
                        "state": {
                                "acked": false,
                                "ackedBy": "",
                                "unmaskedState": "ok",
                                "ackedTimestamp": "",
                                "state": "ok",
                                "masked": false,
                                "latchedState": "ok",
                                "value": "84.5 LU",
                                "inverted": false,
                                "timestamp": "2020-01-28T09:12:33.001Z"
                                }
                    }
            delete: {
                    # 必填:id
                    ID: {
                        # 报警的唯一标识符
                        # 必填:name, path

                        path: 报警设备的唯一标识符。(示例:11704080)
                            # 类型:字符串
                            # 对于IQ设备,这将是RollCall地址
                            # 对于Densite报警,这将是虚拟Linux样式的文件夹路径
                            # 第三方可以使用任何一种方法。该路径用于将多个报警分组在一个公共文件夹下,并在Orbit中用于显示网络树中的项目
                        name: 报警的名称。(示例:POWER_USAGE)
                        # 注意:path+name是报警的唯一键
                        示例:
                        {
                            "path": "11704080",
                            "名称": "POWER_USAGE"
                        }
                    示例:
                    {
                        "update": {
                                "origin": "S00000102",
                                "id": {
                                        "path": "11704080",
                                        "name": "POWER_USAGE"
                                        },
                                "state": {
                                        "acked": false,
                                        "ackedBy": "",
                                        "unmaskedState": "ok",
                                        "ackedTimestamp": "",
                                        "state": "ok",
                                        "masked": false,
                                        "latchedState": "ok",
                                        "value": "84.5 LU",
                                        "inverted": false,
                                        "timestamp": "2020-01-28T09:12:33.001Z"
                                        }
                                    },
                        "delete": {
                               "id": {
                                        "path": "11704080",
                                        "name": "POWER_USAGE"
                                       }
                                    }
                    }
]

示例:
{
    "items": [
        {
            "update": {
                "origin": "S00000102",
                "id": {
                    "path": "11704080",
                    "name": "POWER_USAGE"
                },
                "state": {
                    "acked": false,
                    "ackedBy": "",
                    "unmaskedState": "ok",
                    "ackedTimestamp": "",
                    "state": "ok",
                    "masked": false,
                    "latchedState": "ok",
                    "value": "84.5 LU",
                    "inverted": false,
                    "timestamp": "2020-01-28T09:12:33.001Z"
                }
            },
            "delete": {
                "id": {
                    "path": "11704080",
                    "name": "POWER_USAGE"
                }
            }
        },
        {
            "update": {
                "origin": "S00000102",
                "id": {
                    "path": "11704080",
                    "name": "POWER_USAGE"
                },
                "state": {
                    "acked": false,
                    "ackedBy": "",
                    "unmaskedState": "ok",
                    "ackedTimestamp": "",
                    "state": "ok",
                    "masked": false,
                    "latchedState": "ok",
                    "value": "84.5 LU",
                    "inverted": false,
                    "timestamp": "2020-01-28T09:12:33.001Z"
                }
            },
            "delete": {
                "id": {
                    "path": "11704080",
                    "name": "POWER_USAGE"
                }
            }
        }
    ]
}
  • 状态:204-在此轮询期间未发生任何事件。没有数据。客户可以继续轮询新数据。
  • 状态:401-未经身份验证。
  • 状态:404-找不到订阅ID。

getAlarms

获取给定设备的报警列表。

返回给定设备的报警。可以使用/devices端点获取设备路径。如果需要多个设备报警,则需要为每个设备进行多个调用。

另一种方法是订阅报警更改。使用这种方法时,将首先发送所有报警,然后再进行更新。

GET方法

/alarms

用法和SDK示例

  • Curl
curl -X GET\
 -H "Accept: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/alarms?path=&name="
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        String path = path_example; // String | The path identifying the device for which the alarms should be obtained.
        String name = name_example; // String | The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP

        try {
            array[Alarm] result = apiInstance.getAlarms(path, name);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getAlarms");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String path = path_example; // String | The path identifying the device for which the alarms should be obtained.
        String name = name_example; // String | The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP

        try {
            array[Alarm] result = apiInstance.getAlarms(path, name);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getAlarms");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *path = path_example; // The path identifying the device for which the alarms should be obtained. (default to null)
String *name = name_example; // The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP (optional) (default to null)

// Gets a list of the alarms for a given device.
[apiInstance getAlarmsWith:path
    name:name
              completionHandler: ^(array[Alarm] output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var path = path_example; // {String} The path identifying the device for which the alarms should be obtained.
var opts = {
  'name': name_example // {String} The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getAlarms(path, opts, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class getAlarmsExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var path = path_example;  // String | The path identifying the device for which the alarms should be obtained. (default to null)
            var name = name_example;  // String | The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP (optional)  (default to null)

            try {
                // Gets a list of the alarms for a given device.
                array[Alarm] result = apiInstance.getAlarms(path, name);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.getAlarms: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$path = path_example; // String | The path identifying the device for which the alarms should be obtained.
$name = name_example; // String | The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP

try {
    $result = $api_instance->getAlarms($path, $name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getAlarms: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $path = path_example; # String | The path identifying the device for which the alarms should be obtained.
my $name = name_example; # String | The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP

eval { 
    my $result = $api_instance->getAlarms(path => $path, name => $name);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->getAlarms: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
path = path_example # String | The path identifying the device for which the alarms should be obtained. (default to null)
name = name_example # String | The name of an alarm to obtain. This field may be empty, contain a * character or   a single character wildcard ?. I.e. to return all CPU_N_TEMP alarms use CPU_*_TEMP (optional) (default to null)

try: 
    # Gets a list of the alarms for a given device.
    api_response = api_instance.get_alarms(path, name=name)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->getAlarms: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let path = path_example; // String
    let name = name_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.getAlarms(path, name, &context).wait();

    println!("{:?}", result);
}

范围

参数
查询参数
名称描述
path*标识应为其获取警报的设备的路径。必须;类型: 字符串
name要获取的警报的名称。该字段可以为空、包含一个字符或单个字符通配符?。如返回所有CPUN TEMP报警可使用CPU TEMP。类型: 字符串
返回值
  • 状态:200-包含当前警报快照的警报对象数组。
[
    {
    # 警报对象提供监视系统内报警的状态。报警包含在可能是虚拟的或代表物理设备的设备(有时称为单元)内。报警可用于指示错误,也可用于记录有关设备的信息。虚拟警报可能来自其他警报。
    # 必填: id, state
    ID: {
        # 报警的唯一标识符
        # 必填: name, path
        path:  包含报警的设备的唯一标识符(示例:11704080)
            # 类型:字符串
            # 对于IQ设备,这将是RollCall地址
            # 对于Densite报警,这将是虚拟Linux样式的文件夹路径
            # 第三方可以使用任何一种方法。该路径用于将多个警报分组在一个公共文件夹下,并在Orbit中用于显示网络树中的项目。
        name: 报警的名称 (示例:POWER_USAGE)
            # 类型:字符串
            # path+name是报警的唯一键。
        示例:
        {
            "path": "11704080",
            "name": "POWER_USAGE"
        }
    origin: 用作警报的父标识符(示例:S00000102)
        # 类型:字符串
        # 物理警报采用原始设备的序列号。虚拟警报不会使用此字段。
    state: {
        # 获取报警的当前状态。
        # 必需:state, timestamp
        state: 报警的当前状态(示例:ok)
            # 类型:字符串
            # 有效值为:"nostate", "ok", "warn", "caution", "fail" ,其中"fail"最严重。
            # 枚举: nostate,ok,warn,caution,fail,text
        latchedState: 当前报警的闩锁状态 (示例:ok)
            # 类型:字符串
            # 由于用户重置了闩锁,该报警处于最差的状态
            # 允许在报警变绿之前短暂地出错。
        unmaskedState: 当前报警屏蔽状态(示例:ok)
            # 类型:字符串
            # 如果屏蔽了报警,则其状态将被抑制,状态字段将变为"nostate"
            # 如果未应用屏蔽,则该字段将捕获状态。
        timestamp: 报警的时间戳(示例:2020-01-28T09:12:33.001Z)
            # 类型:字符串 (date-time)
        value: 警报的值(或文本)内容(示例:84.5 LU)
            # 类型:字符串
        masked: 标志警报被屏蔽,警报状态被抑制 
            # 类型:布尔值
        inverted: 标志报警已反转   
            # 类型:布尔值
            # 警报倒置时,"ok"倒置为和"fail"和"warn"一样,"caution"和"fail"倒置为和"ok"一样。
        acked: 如果警报已被用户确认,则为True    
            # 类型:布尔值
        ackedTimestamp:确认警报的时间戳 
            # 类型:字符串 (date-time)
        ackedBy:确认警报的用户(或主机)的名称。
            # 类型:字符串
        示例:
        {
            "acked": false,
            "ackedBy": "",
            "unmaskedState": "ok",
            "ackedTimestamp": "",
            "state": "ok",
            "masked": false,
            "latchedState": "ok",
            "value": "84.5 LU",
            "inverted": false,
            "timestamp": "2020-01-28T09:12:33.001Z"
        }
    示例:
    {
        "origin": "S00000102",
        "id": {
                "path": "11704080",
                "name": "POWER_USAGE"
                },
        "state": {
                "acked": false,
                "ackedBy": "",
                "unmaskedState": "ok",
                "ackedTimestamp": "",
                "state": "ok",
                "masked": false,
                "latchedState": "ok",
                "value": "84.5 LU",
               "inverted": false,
                "timestamp": "2020-01-28T09:12:33.001Z"
                }
    }
]
  • 状态:400-输入参数错误。
  • 状态:401-未经身份验证。

getDevices

获取设备路径列表。

返回监视系统中所有设备路径的列表。然后,该路径可用于后续请求中,以获取特定设备的警报。单个设备通常会具有与其关联的多个警报。设备可以是虚拟的或物理的。

GET方法

/devices

用法和SDK示例

  • Curl
curl -X GET\
 -H "Accept: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/devices"
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();

        try {
            array['String'] result = apiInstance.getDevices();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getDevices");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();

        try {
            array['String'] result = apiInstance.getDevices();
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getDevices");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];

// Gets a list of device paths.
[apiInstance getDevicesWithCompletionHandler: 
              ^(array['String'] output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getDevices(callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class getDevicesExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();

            try {
                // Gets a list of device paths.
                array['String'] result = apiInstance.getDevices();
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.getDevices: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();

try {
    $result = $api_instance->getDevices();
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getDevices: ', $e->getMessage(), PHP_EOL;
}
?>

Perl

use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();

eval { 
    my $result = $api_instance->getDevices();
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->getDevices: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()

try: 
    # Gets a list of device paths.
    api_response = api_instance.get_devices()
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->getDevices: %s\n" % e)

Rust

extern crate DefaultApi;

pub fn main() {

    let mut context = DefaultApi::Context::default();
    let result = client.getDevices(&context).wait();

    println!("{:?}", result);
}

范围

参数
返回值
  • 状态:200-设备路径数组
[
示例:A000:01:01
# 类型: 字符串
]
  • 状态:401-未经身份验证。

getPublisher

通知服务器此发布者仍然有效。

使发布ID在服务器上保持存活状态,并将有关其有效性的状态信息返回给客户端。对于使用给定发布ID创建的警报,它可以保持存活状态。带有该发布ID的任何警报更新也会使警报保持活动状态。

GET方法

/publishers

用法和SDK示例

  • Curl
curl -X GET\
 -H "Accept: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/publishers?publicationId="
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        String publicationId = publicationId_example; // String | The publication id obtained when the publisher was created.

        try {
            Publication result = apiInstance.getPublisher(publicationId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getPublisher");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String publicationId = publicationId_example; // String | The publication id obtained when the publisher was created.

        try {
            Publication result = apiInstance.getPublisher(publicationId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getPublisher");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *publicationId = publicationId_example; // The publication id obtained when the publisher was created. (default to null)

// Informs the server that this publisher is still valid.
[apiInstance getPublisherWith:publicationId
              completionHandler: ^(Publication output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var publicationId = publicationId_example; // {String} The publication id obtained when the publisher was created.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getPublisher(publicationId, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class getPublisherExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var publicationId = publicationId_example;  // String | The publication id obtained when the publisher was created. (default to null)

            try {
                // Informs the server that this publisher is still valid.
                Publication result = apiInstance.getPublisher(publicationId);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.getPublisher: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$publicationId = publicationId_example; // String | The publication id obtained when the publisher was created.

try {
    $result = $api_instance->getPublisher($publicationId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getPublisher: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $publicationId = publicationId_example; # String | The publication id obtained when the publisher was created.

eval { 
    my $result = $api_instance->getPublisher(publicationId => $publicationId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->getPublisher: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
publicationId = publicationId_example # String | The publication id obtained when the publisher was created. (default to null)

try: 
    # Informs the server that this publisher is still valid.
    api_response = api_instance.get_publisher(publicationId)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->getPublisher: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let publicationId = publicationId_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.getPublisher(publicationId, &context).wait();

    println!("{:?}", result);
}

范围

参数
查询参数
名称描述
publicationId *创建发布者时获得的发布ID。必填;类型:字符串
返回值
  • 状态:200-发布ID有效。
{
    #提供发布者的详细信息。
    # 必填: name
    origin: 发布者的UUID(示例:123e4567-e89b-12d3-a456-426614174000)
        # 类型:字符串
    name: 标识发布者的某些名称(示例:Blaze视频处理)
        # 类型:字符串
}    
示例:
{
    "origin": "123e4567-e89b-12d3-a456-426614174000",
    "name": "Blaze Video Processing"
}
  • 状态:401-未经身份验证。
  • 状态:404-找不到订阅ID /该订阅ID无效。

getSubscriber

测试订阅ID的有效性。

对于给定的订阅ID,如果有效,则返回http 200,否则返回http 404。
客户端可以使用它定期检测订阅是否丢失(例如被自动删除)或服务器重新启动。如果发生这些情况,则客户端将需要重新创建订阅。

GET方法

/subscribers

用法和SDK示例

  • Curl
curl -X GET\
 -H "Accept: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/subscribers?subscriptionId="
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        String subscriptionId = subscriptionId_example; // String | The subscription id obtained from the call to subscribe.

        try {
            Subscription result = apiInstance.getSubscriber(subscriptionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getSubscriber");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String subscriptionId = subscriptionId_example; // String | The subscription id obtained from the call to subscribe.

        try {
            Subscription result = apiInstance.getSubscriber(subscriptionId);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#getSubscriber");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *subscriptionId = subscriptionId_example; // The subscription id obtained from the call to subscribe. (default to null)

// Tests a subscription id for validity.
[apiInstance getSubscriberWith:subscriptionId
              completionHandler: ^(Subscription output, NSError* error) {
    if (output) {
        NSLog(@"%@", output);
    }
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var subscriptionId = subscriptionId_example; // {String} The subscription id obtained from the call to subscribe.

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully. Returned data: ' + data);
  }
};
api.getSubscriber(subscriptionId, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class getSubscriberExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var subscriptionId = subscriptionId_example;  // String | The subscription id obtained from the call to subscribe. (default to null)

            try {
                // Tests a subscription id for validity.
                Subscription result = apiInstance.getSubscriber(subscriptionId);
                Debug.WriteLine(result);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.getSubscriber: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$subscriptionId = subscriptionId_example; // String | The subscription id obtained from the call to subscribe.

try {
    $result = $api_instance->getSubscriber($subscriptionId);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->getSubscriber: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $subscriptionId = subscriptionId_example; # String | The subscription id obtained from the call to subscribe.

eval { 
    my $result = $api_instance->getSubscriber(subscriptionId => $subscriptionId);
    print Dumper($result);
};
if ($@) {
    warn "Exception when calling DefaultApi->getSubscriber: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
subscriptionId = subscriptionId_example # String | The subscription id obtained from the call to subscribe. (default to null)

try: 
    # Tests a subscription id for validity.
    api_response = api_instance.get_subscriber(subscriptionId)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling DefaultApi->getSubscriber: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let subscriptionId = subscriptionId_example; // String

    let mut context = DefaultApi::Context::default();
    let result = client.getSubscriber(subscriptionId, &context).wait();

    println!("{:?}", result);
}

范围

参数
查询参数
名称描述
subscriptionId *从订阅调用获得的订阅ID。必填;类型:字符串
返回值
  • 状态:200-订阅ID有效。
{
    # 提供有关新订阅的详细信息。
    # 必填:type
    type: "push" or "pull" (示例:push)
        # 类型: 字符串
        # 可以是“推”(push)或“拉”(pull),具体取决于客户端希望接收通知的方式。
    url: 服务器应在其中发送事件的回调URL (示例:http://192.168.15.2/my_app/alarm_handler)
        # 类型: 字符串   
        # 当type设置为"push"时必需
        # 当type设置为"pull"时不需要,因为客户端负责通过通知/拉动端点拉动更改。
        # 发送到此url的数据将是一个Event对象,然后包含一个Event Items列表。
    filter: [
            # 当将变化传递给客户端时,服务器用作警报过滤器的组数。
            # 空数组将交付所有内容。
                {
                # 设备的唯一标识符
                # 必填:path

                path: 包含警报的设备的唯一标识符(示例:11704080)
                    # 类型:字符串
                    # 对于IQ设备,这将是RollCall地址
                    # 对于Densite警报,这将是虚拟Linux样式的文件夹路径
                    # 第三方可以使用任何一种方法。
                    # 该路径用于将多个警报分组在一个公共文件夹下,并在Orbit中用于显示网络树中的项目。
                示例: 
                {
                    "path": "11704080",
                    "name": "POWER_USAGE"
                }
            ]
示例:
{
    "filter": [
        {
            "path": "A000:01:02"
        },
        {
            "path": "A000:02:03"
        }
    ],
    "type": "push",
    "url": "http://192.168.15.2/my_app/alarm_handler"
}
  • 状态:401-未经身份验证。
  • 状态:404-找不到订阅ID /该订阅ID无效。

ping

返回指示服务是否有效的http状态代码。

获取指示服务REST API是否有效且正在运行的http状态代码。

GET方法

/ping

用法和SDK示例

  • Curl
curl -X GET\
 "http://gv-orbit-server:9099/alarmapi/v1/ping"
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();

        try {
            apiInstance.ping();
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#ping");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();

        try {
            apiInstance.ping();
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#ping");
            e.printStackTrace();
        }
    }
}
  • Obj-C

// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];

// Returns a http status code indicating whether the service is alive or not.
[apiInstance pingWithCompletionHandler: 
              ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.ping(callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class pingExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();

            try {
                // Returns a http status code indicating whether the service is alive or not.
                apiInstance.ping();
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.ping: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();

try {
    $api_instance->ping();
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->ping: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();

eval { 
    $api_instance->ping();
};
if ($@) {
    warn "Exception when calling DefaultApi->ping: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()

try: 
    # Returns a http status code indicating whether the service is alive or not.
    api_instance.ping()
except ApiException as e:
    print("Exception when calling DefaultApi->ping: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {

    let mut context = DefaultApi::Context::default();
    let result = client.ping(&context).wait();

    println!("{:?}", result);
}

范围

参数
返回值
  • 状态:204-确定

removeAlarms

从监视系统中删除警报

从监视系统中删除警报。客户端应提供应删除的警报列表。

名称字段中可以使用单个*符号,在这种情况下,所有警报都将被删除。标识设备的路径字段必须完整指定。

POST方法

/alarms/deletions

用法和SDK示例

  • Curl
curl -X POST\
 -H "Content-Type: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/alarms/deletions?publicationId="
  • Java
import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        String publicationId = publicationId_example; // String | The publication id of the publisher to delete
        array[Id] alarms = ; // array[Id] | 

        try {
            apiInstance.removeAlarms(publicationId, alarms);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#removeAlarms");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        String publicationId = publicationId_example; // String | The publication id of the publisher to delete
        array[Id] alarms = ; // array[Id] | 

        try {
            apiInstance.removeAlarms(publicationId, alarms);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#removeAlarms");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
String *publicationId = publicationId_example; // The publication id of the publisher to delete (default to null)
array[Id] *alarms = ; //  (optional)

// Removes alarms from the monitoring system
[apiInstance removeAlarmsWith:publicationId
    alarms:alarms
              completionHandler: ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var publicationId = publicationId_example; // {String} The publication id of the publisher to delete
var opts = {
  'alarms':  // {array[Id]} 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.removeAlarms(publicationId, opts, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class removeAlarmsExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var publicationId = publicationId_example;  // String | The publication id of the publisher to delete (default to null)
            var alarms = new array[Id](); // array[Id] |  (optional) 

            try {
                // Removes alarms from the monitoring system
                apiInstance.removeAlarms(publicationId, alarms);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.removeAlarms: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$publicationId = publicationId_example; // String | The publication id of the publisher to delete
$alarms = ; // array[Id] | 

try {
    $api_instance->removeAlarms($publicationId, $alarms);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->removeAlarms: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $publicationId = publicationId_example; # String | The publication id of the publisher to delete
my $alarms = [WWW::OPenAPIClient::Object::array[Id]->new()]; # array[Id] | 

eval { 
    $api_instance->removeAlarms(publicationId => $publicationId, alarms => $alarms);
};
if ($@) {
    warn "Exception when calling DefaultApi->removeAlarms: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
publicationId = publicationId_example # String | The publication id of the publisher to delete (default to null)
alarms =  # array[Id] |  (optional)

try: 
    # Removes alarms from the monitoring system
    api_instance.remove_alarms(publicationId, alarms=alarms)
except ApiException as e:
    print("Exception when calling DefaultApi->removeAlarms: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let publicationId = publicationId_example; // String
    let alarms = ; // array[Id]

    let mut context = DefaultApi::Context::default();
    let result = client.removeAlarms(publicationId, alarms, &context).wait();

    println!("{:?}", result);
}

范围

参数
主体参数
名称描述
alarms要删除的警报ID的数组
[
# 类型:undefined
]
查询参数
名称描述
publicationId *要删除的发布者的发布ID。必填;类型:字符串
返回值
  • 状态:204-警报已删除,确定。
  • 状态:400-输入无效,对象无效
  • 状态:403-服务器上的写访问权限被禁用。
  • 状态:401-未经身份验证。
  • 状态:409-现有项目已经存在,无法修改。检查publicationId对于您要删除的警报是否有效。

setAlarms

添加或更新警报

在监视系统中添加或更新(一系列)警报。path和name唯一标识警报,并且未被现有警报使用,或者在“来源”字段中指定的发布ID必须与现有警报匹配,在这种情况下,它将进行更新。

警报使用发布ID来添加。应该首先使用发布端点进行发布ID注册。

在添加警报之前,客户端应使用发布ID填充’origin’ 字段。

POST方法

/alarms

用法和SDK示例

  • Curl
curl -X POST\
 -H "Content-Type: application/json"\
 "http://gv-orbit-server:9099/alarmapi/v1/alarms"
  • Java

import org.openapitools.client.*;
import org.openapitools.client.auth.*;
import org.openapitools.client.model.*;
import org.openapitools.client.api.DefaultApi;

import java.io.File;
import java.util.*;

public class DefaultApiExample {
    public static void main(String[] args) {

        // Create an instance of the API class
        DefaultApi apiInstance = new DefaultApi();
        array[Alarm] alarms = ; // array[Alarm] | 

        try {
            apiInstance.setAlarms(alarms);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#setAlarms");
            e.printStackTrace();
        }
    }
}
  • Android
import org.openapitools.client.api.DefaultApi;

public class DefaultApiExample {
    public static void main(String[] args) {
        DefaultApi apiInstance = new DefaultApi();
        array[Alarm] alarms = ; // array[Alarm] | 

        try {
            apiInstance.setAlarms(alarms);
        } catch (ApiException e) {
            System.err.println("Exception when calling DefaultApi#setAlarms");
            e.printStackTrace();
        }
    }
}
  • Obj-C
// Create an instance of the API class
DefaultApi *apiInstance = [[DefaultApi alloc] init];
array[Alarm] *alarms = ; //  (optional)

// Adds or updates alarms
[apiInstance setAlarmsWith:alarms
              completionHandler: ^(NSError* error) {
    if (error) {
        NSLog(@"Error: %@", error);
    }
}];
  • JavaScript
var GvOrbitAlarmApi = require('gv_orbit_alarm_api');

// Create an instance of the API class
var api = new GvOrbitAlarmApi.DefaultApi()
var opts = {
  'alarms':  // {array[Alarm]} 
};

var callback = function(error, data, response) {
  if (error) {
    console.error(error);
  } else {
    console.log('API called successfully.');
  }
};
api.setAlarms(opts, callback);
  • C#
using System;
using System.Diagnostics;
using Org.OpenAPITools.Api;
using Org.OpenAPITools.Client;
using Org.OpenAPITools.Model;

namespace Example
{
    public class setAlarmsExample
    {
        public void main()
        {

            // Create an instance of the API class
            var apiInstance = new DefaultApi();
            var alarms = new array[Alarm](); // array[Alarm] |  (optional) 

            try {
                // Adds or updates alarms
                apiInstance.setAlarms(alarms);
            } catch (Exception e) {
                Debug.Print("Exception when calling DefaultApi.setAlarms: " + e.Message );
            }
        }
    }
}
  • PHP
<?php
require_once(__DIR__ . '/vendor/autoload.php');

// Create an instance of the API class
$api_instance = new OpenAPITools\Client\Api\DefaultApi();
$alarms = ; // array[Alarm] | 

try {
    $api_instance->setAlarms($alarms);
} catch (Exception $e) {
    echo 'Exception when calling DefaultApi->setAlarms: ', $e->getMessage(), PHP_EOL;
}
?>
  • Perl
use Data::Dumper;
use WWW::OPenAPIClient::Configuration;
use WWW::OPenAPIClient::DefaultApi;

# Create an instance of the API class
my $api_instance = WWW::OPenAPIClient::DefaultApi->new();
my $alarms = [WWW::OPenAPIClient::Object::array[Alarm]->new()]; # array[Alarm] | 

eval { 
    $api_instance->setAlarms(alarms => $alarms);
};
if ($@) {
    warn "Exception when calling DefaultApi->setAlarms: $@\n";
}
  • Python
from __future__ import print_statement
import time
import openapi_client
from openapi_client.rest import ApiException
from pprint import pprint

# Create an instance of the API class
api_instance = openapi_client.DefaultApi()
alarms =  # array[Alarm] |  (optional)

try: 
    # Adds or updates alarms
    api_instance.set_alarms(alarms=alarms)
except ApiException as e:
    print("Exception when calling DefaultApi->setAlarms: %s\n" % e)
  • Rust
extern crate DefaultApi;

pub fn main() {
    let alarms = ; // array[Alarm]

    let mut context = DefaultApi::Context::default();
    let result = client.setAlarms(alarms, &context).wait();

    println!("{:?}", result);
}

范围

参数
身体参数
名称描述
alarms未知类型
[
# 类型: 未定义undefined
]
返回值
  • 状态:201-警报已创建或更新。
  • 状态:400-无效输入,请求已被拒绝。
  • 状态:403-服务器上的写访问权限被禁用。
  • 状态:401-未经身份验证。
  • 状态:409-现有项目已经存在,无法修改。检查来源是否设置为有效的发布ID
Back to Top