如何使用REST API创建事件网格域主题订阅? [英] How to create event grid domain topic subscription using REST API?

查看:69
本文介绍了如何使用REST API创建事件网格域主题订阅?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在事件网格中创建了事件网格主题.现在,我想使用 rest api 为该主题创建事件订阅.

I have created event grid topic inside event grid domain. Now I want to create event subscription for that topic using rest api.

我已通过此链接阅读文档

I have read docs through this link

https://docs.microsoft.com/en-us/rest/api/eventgrid/eventsubscriptions/createorupdate?source=docs#uri-parameters.

但是我找不到我需要的URL.

But I am not able to find url for what I need.

我已经尝试过该网址.

https://management.azure.com/subscriptions/ {subscription ID}/resourceGroups/{资源组名称}/providers/Microsoft.EventGrid/domains/{事件网格域名}/topics/{主题名称}/providers/Microsoft.EventGrid/eventSubscriptions/{事件订阅名称}?api-version = 2019-02-01预览

https://management.azure.com/subscriptions/{subscription ID}/resourceGroups/{resourse group name}/providers/Microsoft.EventGrid/domains/{event grid domain name}/topics/{topic name}/providers/Microsoft.EventGrid/eventSubscriptions/{event subscription name}?api-version=2019-02-01-preview

推荐答案

可以使用以下API创建域主题:

The domain topic can be created using the following APIs:

  1. 域主题-创建或更新

例如:

https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.EventGrid/domains/myDomain/topics/myTopicXXX?api-version=2020-01-01-preview

有效载荷为空:{}

事件订阅-创建或更新

例如:

https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myRG/providers/Microsoft.EventGrid/domains/myDomain/topics/myTopic/providers/Microsoft.EventGrid/eventSubscriptions/mySubscription?api-version=2020-01-01-preview

有效负载示例:

    {
      "properties":{
       "destination":{
          "endpointType":"HybridConnection",
          "properties":{
            "resourceId":"<myHybridConnectionresourceId>"
          }
        },
        "filter":{
        "isSubjectCaseSensitive":false,
        "subjectBeginsWith":null,
        "subjectEndsWith":null
        },
        "labels":[],
        "eventDeliverySchema":"EventGridSchema",
        "retryPolicy":{
          "maxDeliveryAttempts":3,
          "eventTimeToLiveInMinutes":1440
         }
      }
    }

在这种情况下,领域主题将在不存在时自动创建.请注意,这是一项很棒的功能,可以从订户端创建主题.

In this case, the domain topic will be created automatically when doesn't exist it. Note, that this is a great feature allows to create a topic from the subscriber side.

顺便说一句.看看我的 Azure事件网格工具,它是建立在REST API上.

Btw. have a look at my Azure Event Grid Tools, it is built on the REST APIs.

这篇关于如何使用REST API创建事件网格域主题订阅?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆