热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

RabbitMQManagementHTTPAPI官方文档

IntroductionApartfromthishelppage,allURIswillserveonlyresourcesoftypeapplicationjson,andwi

Introduction

Apart from this help page, all URIs will serve only resources of type application/json, and will require HTTP basic authentication (using the standard RabbitMQ user database). The default user is guest/guest.

Many URIs require the name of a virtual host as part of the path, since names only uniquely identify objects within a virtual host. As the default virtual host is called "/", this will need to be encoded as "%2f".

PUTing a resource creates it. The JSON object you upload must have certain keys (documented below). Other keys are ignored. Missing keys consitute an error.

Since bindings do not have names or IDs in AMQP we synthesise one based on all its properties. Since predicting this name is hard in the general case, you can also create bindings by POSTing to a factory URI. See the example below.

Caveats

These caveats apply to the current development version of the management API. In future they will be fixed.

  • arguments fields are ignored everywhere. You cannot create a queue, exchange or binding with arguments. Queues, exchanges or bindings with arguments won‘t show those arguments.
  • Permissions are only enforced sporadically. If a user can authenticate with the HTTP API, they can do anything.
  • There are many monitoring-related information items in the objects returned from GET requests. They are undocumented and subject to change.

Examples

A few quick examples, using the Unix command line tool curl:

  • Get a list of vhosts:
    $ curl -i -u guest:guest http://localhost:55672/api/vhosts
    HTTP/1.1 200 OK
    Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
    Date: Tue, 31 Aug 2010 15:46:59 GMT
    Content-Type: application/json
    Content-Length: 5
    
    ["/"]
  • Create a new vhost:
    $ curl -i -u guest:guest -H "content-type:application/json"   -XPUT http://localhost:55672/api/vhosts/foo
    HTTP/1.1 204 No Content
    Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
    Date: Fri, 27 Aug 2010 16:56:00 GMT
    Content-Type: application/json
    Content-Length: 0

    Note: you must specify application/json as the mime type.

    Note: the name of the object is not needed in the JSON object uploaded, since it is in the URI. As a virtual host has no properties apart from its name, this means you do not need to specify a body at all!

  • Create a new exchange in the default virtual host:
    $ curl -i -u guest:guest -H "content-type:application/json"   -XPUT -d‘{"type":"direct","auto_delete":false,"durable":true,"arguments":[]}‘   http://localhost:55672/api/exchanges/%2f/my-new-exchange
    HTTP/1.1 204 No Content
    Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
    Date: Fri, 27 Aug 2010 17:04:29 GMT
    Content-Type: application/json
    Content-Length: 0

    Note: we never return a body in response to a PUT or DELETE, unless it fails.

  • And delete it again:
    $ curl -i -u guest:guest -H "content-type:application/json"   -XDELETE http://localhost:55672/api/exchanges/%2f/my-new-exchange
    HTTP/1.1 204 No Content
    Server: MochiWeb/1.1 WebMachine/1.7 (participate in the frantic)
    Date: Fri, 27 Aug 2010 17:05:30 GMT
    Content-Type: application/json
    Content-Length: 0

Reference

GETPUTDELETEPOSTPathDescription
X       /api/overview Various random bits of information that describe the whole system.
X       /api/connections A list of all open connections.
X   X   /api/connections/name An individual connection. DELETEing it will close the connection.
X       /api/channels A list of all open channels.
X       /api/channels/channel Details about an individual channel.
X       /api/exchanges A list of all exchanges.
X       /api/exchanges/vhost A list of all exchanges in a given virtual host.
X X X   /api/exchanges/vhost/name An individual exchange. To PUT an exchange, you will need a body looking something like this:
{"type":"direct","auto_delete":false,"durable":true,"arguments":[]}
X       /api/exchanges/vhost/name/bindings A list of all bindings on a given exchange.
X       /api/queues A list of all queues.
X       /api/queues/vhost A list of all queues in a given virtual host.
X X X   /api/queues/vhost/name An individual queue. To PUT a queue, you will need a body looking something like this:
{"auto_delete":false,"durable":true,"arguments":[]}
X       /api/queues/vhost/queue/bindings A list of all bindings on a given queue.
X       /api/bindings A list of all bindings.
X       /api/bindings/vhost A list of all bindings in a given virtual host.
X     X /api/bindings/vhost/queue/exchange A list of all bindings between a queue and an exchange. Remember, a queue and an exchange can be bound together many times! To create a new binding, POST to this URI. You will need a body looking something like this:
{"routing_key":"my_routing_key","arguments":[]}
The response will contain a Location header telling you the URI of your new binding.
X X X   /api/bindings/vhost/queue/exchange/props An individual binding between a queue and an exchange. The props part of the URI is a "name" for the binding composed of its routing key and properties. While you can create a binding by PUTing to this URI, it may be more convenient to POST to the URI above.
X       /api/vhosts A list of all vhosts.
X X X   /api/vhosts/name An individual virtual host. As a virtual host only has a name, you do not need an HTTP body when PUTing one of these.
X       /api/users A list of all users.
X X X   /api/users/name An individual user. To PUT a user, you will need a body looking something like this:
{"password":"secret"}
X       /api/users/user/permissions A list of all permissions for a given user.
X       /api/permissions A list of all permissions for all users.
X X X   /api/permissions/vhost/user An individual permission of a user and virtual host. To PUT a permission, you will need a body looking something like this:
{"scope":"client","configure":".*","write":".*","read":".*"}

RabbitMQ Management HTTP API--官方文档


推荐阅读
  • C#中实现高效UDP数据传输技术
    C#中实现高效UDP数据传输技术 ... [详细]
  • Node.js 教程第五讲:深入解析 EventEmitter(事件监听与发射机制)
    本文将深入探讨 Node.js 中的 EventEmitter 模块,详细介绍其在事件监听与发射机制中的应用。内容涵盖事件驱动的基本概念、如何在 Node.js 中注册和触发自定义事件,以及 EventEmitter 的核心 API 和使用方法。通过本教程,读者将能够全面理解并熟练运用 EventEmitter 进行高效的事件处理。 ... [详细]
  • 本文深入探讨了 iOS 开发中 `int`、`NSInteger`、`NSUInteger` 和 `NSNumber` 的应用与区别。首先,我们将详细介绍 `NSNumber` 类型,该类用于封装基本数据类型,如整数、浮点数等,使其能够在 Objective-C 的集合类中使用。通过分析这些类型的特性和应用场景,帮助开发者更好地理解和选择合适的数据类型,提高代码的健壮性和可维护性。苹果官方文档提供了更多详细信息,可供进一步参考。 ... [详细]
  • 本文深入解析了 Apache 配置文件 `httpd.conf` 和 `.htaccess` 的优化方法,探讨了如何通过合理配置提升服务器性能和安全性。文章详细介绍了这两个文件的关键参数及其作用,并提供了实际应用中的最佳实践,帮助读者更好地理解和运用 Apache 配置。 ... [详细]
  • C++ STL 常见函数应用详解与实例解析
    本文详细解析了 C++ STL 中常见函数的应用,并通过具体实例进行说明。特别地,文章对迭代器(iterator)的概念进行了深入探讨,将其视为一种将迭代操作抽象化的工具,便于在不同容器间进行元素访问和操作。此外,还介绍了迭代器的基本类型、使用方法及其在算法中的应用,为读者提供了丰富的实践指导。 ... [详细]
  • Git基础操作指南:掌握必备技能
    掌握 Git 基础操作是每个开发者必备的技能。本文详细介绍了 Git 的基本命令和使用方法,包括初始化仓库、配置用户信息、添加文件、提交更改以及查看版本历史等关键步骤。通过这些操作,读者可以快速上手并高效管理代码版本。例如,使用 `git config --global user.name` 和 `git config --global user.email` 来设置全局用户名和邮箱,确保每次提交时都能正确标识提交者信息。 ... [详细]
  • 深入解析 OpenCV 2 中 Mat 对象的类型、深度与步长属性
    在OpenCV 2中,`Mat`类作为核心组件,对于图像处理至关重要。本文将深入探讨`Mat`对象的类型、深度与步长属性,这些属性是理解和优化图像操作的基础。通过具体示例,我们将展示如何利用这些属性实现高效的图像缩小功能。此外,还将讨论这些属性在实际应用中的重要性和常见误区,帮助读者更好地掌握`Mat`类的使用方法。 ... [详细]
  • 通过优化模板消息机制,本研究提出了一种高效的信息化推送方案。该方案利用获取的访问令牌(access token)和指定的模板ID,实现了精准且快速的信息推送,显著提升了用户体验和信息传递效率。具体实现中,通过调用相关API接口,确保了消息的准确性和及时性,为用户提供更加便捷的服务。 ... [详细]
  • jQuery Flot 数据可视化插件:高效绘制图表的专业工具
    jQuery Flot 是一款高效的数据可视化插件,专为绘制各种图表而设计。该工具支持丰富的图表类型和自定义选项,适用于多种应用场景。用户可以通过其官方网站获取示例代码和下载资源,以便快速上手和使用。 ... [详细]
  • 解决基于XML配置的MyBatis在Spring整合中出现“无效绑定语句(未找到):com.music.dao.MusicDao.findAll”问题的方法
    在将Spring与MyBatis进行整合时,作者遇到了“无效绑定语句(未找到):com.music.dao.MusicDao.findAll”的问题。该问题主要出现在使用XML文件配置DAO层的情况下,而注解方式配置则未出现类似问题。作者详细分析了两个配置文件之间的差异,并最终找到了解决方案。本文将详细介绍问题的原因及解决方法,帮助读者避免类似问题的发生。 ... [详细]
  • 本文详细探讨了Java集合框架的使用方法及其性能特点。首先,通过关系图展示了集合接口之间的层次结构,如`Collection`接口作为对象集合的基础,其下分为`List`、`Set`和`Queue`等子接口。其中,`List`接口支持按插入顺序保存元素且允许重复,而`Set`接口则确保元素唯一性。此外,文章还深入分析了不同集合类在实际应用中的性能表现,为开发者选择合适的集合类型提供了参考依据。 ... [详细]
  • PHP中元素的计量单位是什么? ... [详细]
  • 基于Node.js的高性能实时消息推送系统通过集成Socket.IO和Express框架,实现了高效的高并发消息转发功能。该系统能够支持大量用户同时在线,并确保消息的实时性和可靠性,适用于需要即时通信的应用场景。 ... [详细]
  • 微信支付授权目录配置详解及操作步骤
    在使用微信支付时,若通过WeixinJSBridge.invoke方法调用支付功能,可能会遇到“当前页面URL未注册”的错误提示,导致get_brand_wcpay_request:fail调用微信JSAPI支付失败。为解决这一问题,需要正确配置微信支付授权目录,确保支付页面的URL已成功注册。本文将详细介绍微信支付授权目录的配置步骤和注意事项,帮助开发者顺利完成支付功能的集成与调试。 ... [详细]
  • 在Java中,匿名函数作为一种无名的函数结构,无法独立调用;而在JavaScript中,不仅有类似的匿名函数,还有立即执行函数(IIFE)和闭包等高级特性。立即执行函数同样基于匿名函数实现,但会在定义时立即执行,而闭包则通过嵌套函数来捕获外部变量,实现数据封装和持久化。这些不同的函数形式在实际开发中各有应用场景,理解其特点有助于更好地利用语言特性进行编程。 ... [详细]
author-avatar
手浪用户2602881857
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有