Skip to content

Commit f65cc30

Browse files
committed
Merge branch 'j-integra'
2 parents 836647a + 975caab commit f65cc30

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+354
-60
lines changed

code_snippets/api-embeds-create.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from datadog import initialize, api
2+
import json
3+
4+
# Intialize request parameters including API/APP key
5+
options = {
6+
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
7+
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
8+
}
9+
10+
initialize(**options)
11+
12+
# Create an embed graph definition as a dict and format as JSON
13+
graph_json = {
14+
"requests": [{
15+
"q": "avg:system.load.1{*}"
16+
}],
17+
"viz": "timeseries",
18+
"events": []
19+
}
20+
graph_json = json.dumps(graph_json)
21+
22+
api.Embed.create(graph_json=graph_json, timeframe="1_hour", size="medium", legend="no")

code_snippets/api-embeds-create.rb

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
require 'rubygems'
2+
require 'dogapi'
3+
4+
# Initialize API Client
5+
api_key='9775a026f1ca7d1c6c5af9d94d9595a4'
6+
app_key='87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
7+
8+
dog = Dogapi::Client.new(api_key, app_key)
9+
10+
# Prepare parameters
11+
graph_json = '{
12+
"requests": [{
13+
"q": "avg:system.load.1{*}"
14+
}],
15+
"viz": "timeseries",
16+
"events": []
17+
}'
18+
timeframe = "1_hour"
19+
size = "medium"
20+
legend = "no"
21+
title = "Embed created through API"
22+
23+
# Make API Call
24+
status, result = dog.create_embed(graph_json, timeframe, size, legend, title)

code_snippets/api-embeds-enable.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from datadog import initialize, api
2+
3+
# Intialize request parameters including API/APP key
4+
options = {
5+
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
6+
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
7+
}
8+
9+
initialize(**options)
10+
11+
# Set Embed ID (token)
12+
embed_id = "5f585b01c81b12ecdf5f40df0382738d0919170639985d3df5e2fc4232865b0c"
13+
14+
# Call Embed API function
15+
api.Embed.enable(embed_id)

code_snippets/api-embeds-enable.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'rubygems'
2+
require 'dogapi'
3+
4+
# Initialize API Client
5+
api_key='9775a026f1ca7d1c6c5af9d94d9595a4'
6+
app_key='87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
7+
8+
dog = Dogapi::Client.new(api_key, app_key)
9+
10+
# Initialize Embed Token/ID
11+
embed_id = "5f585b01c81b12ecdf5f40df0382738d0919170639985d3df5e2fc4232865b0c"
12+
13+
# Enable with API Call
14+
dog.enable_embed(embed_id)

code_snippets/api-embeds-enable.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
api_key="9775a026f1ca7d1c6c5af9d94d9595a4"
2+
app_key="87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
3+
embed_id="5f585b01c81b12ecdf5f40df0382738d0919170639985d3df5e2fc4232865b0c"
4+
5+
curl -X GET "https://app.datadoghq.com/api/v1/graph/embed/${embed_id}/enable?api_key=${api_key}&application_key=${app_key}"

code_snippets/api-embeds-get-all.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require 'rubygems'
2+
require 'dogapi'
3+
4+
# Initialize API Client
5+
api_key='9775a026f1ca7d1c6c5af9d94d9595a4'
6+
app_key='87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
7+
8+
dog = Dogapi::Client.new(api_key, app_key)
9+
10+
# Get all with API Call
11+
dog.get_all_embeds()
12+

code_snippets/api-embeds-get-all.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
api_key="9775a026f1ca7d1c6c5af9d94d9595a4"
2+
app_key="87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
3+
4+
curl -X GET "https://app.datadoghq.com/api/v1/graph/embed?api_key=${api_key}&application_key=${app_key}"

code_snippets/api-embeds-get.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from datadog import initialize, api
2+
3+
# Intialize request parameters including API/APP key
4+
options = {
5+
'api_key': '9775a026f1ca7d1c6c5af9d94d9595a4',
6+
'app_key': '87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
7+
}
8+
9+
initialize(**options)
10+
11+
# Set Embed ID (token)
12+
embed_id = "5f585b01c81b12ecdf5f40df0382738d0919170639985d3df5e2fc4232865b0c"
13+
14+
# Call Embed API function
15+
api.Embed.get(embed_id, legend="no", size="medium", timeframe="1_hour")

code_snippets/api-embeds-get.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'rubygems'
2+
require 'dogapi'
3+
4+
# Initialize API Client
5+
api_key='9775a026f1ca7d1c6c5af9d94d9595a4'
6+
app_key='87ce4a24b5553d2e482ea8a8500e71b8ad4554ff'
7+
8+
dog = Dogapi::Client.new(api_key, app_key)
9+
10+
# Initialize Embed Token/ID
11+
embed_id = "5f585b01c81b12ecdf5f40df0382738d0919170639985d3df5e2fc4232865b0c"
12+
13+
# Get embed with API Call
14+
dog.enable_embed(embed_id)

code_snippets/api-embeds-get.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
api_key="9775a026f1ca7d1c6c5af9d94d9595a4"
2+
app_key="87ce4a24b5553d2e482ea8a8500e71b8ad4554ff"
3+
embed_id="5f585b01c81b12ecdf5f40df0382738d0919170639985d3df5e2fc4232865b0c"
4+
5+
curl -X GET "https://app.datadoghq.com/api/v1/graph/embed/${embed_id}?api_key=${api_key}&application_key=${app_key}"

0 commit comments

Comments
 (0)