Cisco AMP for Endpoints API

POST /v1/event_streams

Description

Creates a new AMQP messaging resource for events information

When successfully requested, will create a streaming resource accessible using the Advanced Messaging Queue Protocol (AMQP)

The credentials that can be used to connect to this queue are returned in the API response, which includes amqp_credentials hash with keys user_name, password, queue_name, host, port, and proto. You can use these to connect to queue with any client adhering to the AMQP protocol

Other important notes:

  • The passive and durable bits should be set on the queue
  • The protocol is over SSL/TLS. Therefore you should either prefix the uri with amqps:// or explicitly enable TLS on your client

Example implementation in Ruby:

Client implementation with the bunny gem:

require 'bunny'

connection_url = "#{amqp_credentials['proto']}://#{amqp_credentials['user_name']}:#{amqp_credentials['password']}@#{amqp_credentials['host']}:#{amqp_credentials['port']}"

conn = Bunny.new(connection_url)
conn.start

ch = conn.create_channel
q  = ch.queue(amqp_credentials['queue_name'], :passive => true, :durable => true)
x  = ch.default_exchange

q.subscribe(:block => true) do |delivery_info, metadata, payload|
  puts "Received #{payload}"
end

Please note that you can obtain the information about event stream not only from API response immediately after create action, but via the endpoint GET '/v1/event_streams/'.

API Limitations

  • Events have a time-to-live (TTL) of 10 days within each streaming resource
  • limit of 5 active resources across each organization

Show Response Fields

Name Type Description
version String
metadata.links.self String
data.id Integer
data.name String
data.amqp_credentials.user_name String
data.amqp_credentials.password String
data.amqp_credentials.queue_name String
data.amqp_credentials.host String
data.amqp_credentials.port String
data.amqp_credentials.proto String
Write
Preview

Examples

Creates a new event stream

Creates a new event stream

Request

Requires Authorization
POST /v1/event_streams
Headers
accept: application/json
content-type: application/json
authorization: Basic FILTERED
content-length: 99

cURL Edit, then copy and paste on your terminal

curl -X POST \
-H 'accept: application/json' \
-H 'content-type: application/json' \
-H 'content-length: 99' \
--compressed -H 'Accept-Encoding: gzip, deflate' \
-d '{"name":"DQrbpudi","event_type":[1090519054],"group_guid":["bfe6abd0-6591-4bf2-a0d3-02efc1cd268e"]}' \
-u YOUR_API_CLIENT_ID \
'https://api.amp.cisco.com/v1/event_streams'
Body
{"name":"DQrbpudi","event_type":[1090519054],"group_guid":["bfe6abd0-6591-4bf2-a0d3-02efc1cd268e"]}
      

Response

Shortened for readability

x-ratelimit-limit: 3000
x-ratelimit-reset: 3331
x-ratelimit-remaining: 2889
x-frame-options: SAMEORIGIN
x-ratelimit-resetdate: 2017-08-18T03:52:38Z
strict-transport-security: max-age=31536000
status: 201 Created
transfer-encoding: chunked
content-type: application/json; charset=utf-8
{
  "version": "v1.2.0",
  "metadata": {
    "links": {
      "self": "https://api.amp.cisco.com/v1/event_streams"
    }
  },
  "data": {
    "id": 3953,
    "name": "DQrbpudi",
    "amqp_credentials": {
      "user_name": "3953-16db5cf986eec6f44422",
      "password": "bbb59528679f350523061ebb5dfac13e1a9120dd",
      "queue_name": "event_stream_3953",
      "host": "export-streaming-lb1-int.qa1.immunet.com",
      "port": "443",
      "proto": "https"
    }
  }
}