Skip to content

Commit 627efd8

Browse files
authored
Add create map fields using API (#313)
1 parent 2b99325 commit 627efd8

15 files changed

+809
-428
lines changed

apl/data-types/map-fields.mdx

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ description: 'This page explains what map fields are and how to query them.'
44
tags: ['axiom documentation', 'documentation', 'axiom', 'map fields', 'object fields', 'data types']
55
---
66

7+
import ReplaceDomain from "/snippets/replace-domain.mdx"
8+
import ReplaceDatasetToken from "/snippets/replace-dataset-token.mdx"
9+
710
Map fields are a special type of field that can hold a collection of nested key-value pairs within a single field. You can think of the content of a map field as a JSON object.
811

912
Axiom automatically creates map fields in datasets that use [OpenTelemetry](/send-data/opentelemetry) and you can create them yourself.
@@ -50,16 +53,36 @@ If an entity name has spaces (` `), dots (`.`), or dashes (`-`), you can only us
5053

5154
For more information, see [Entity names](/apl/entities/entity-names#quote-identifiers).
5255

53-
## Create map fields
56+
## Create map fields using UI
5457

55-
To create a map field:
58+
To create a map field using the UI:
5659

5760
1. Go to the Datasets tab.
5861
1. Select the dataset where you want to create the map field.
5962
1. In the top right of the fields list, click <img src="/doc-assets/icons/ellipsis-vertical.svg" className="inline-icon" alt="Vertical ellipsis icon" /> **More > Create map field**.
6063
1. In **Field name**, enter the full name of the field, including parent fields, if any. For example, `map_field_name`. For more information on syntax, see [Access properties of nested maps](#access-properties-of-nested-maps)
6164
1. Click **Create map field**.
6265

66+
## Create map fields using API
67+
68+
To create a map field using the Axiom API, send a request to the [Create map field](/restapi/endpoints/createMapField) endpoint. For example:
69+
70+
```bash
71+
curl --request POST \
72+
--url https://AXIOM_DOMAIN/v2/datasets/{DATASET_NAME}/mapfields \
73+
--header 'Authorization: Bearer API_TOKEN' \
74+
--header 'Content-Type: application/json' \
75+
--data '{
76+
"name": "MAP_FIELD"
77+
}'
78+
```
79+
80+
<Info>
81+
<ReplaceDomain />
82+
<ReplaceDatasetToken />
83+
Replace `MAP_FIELD` with the name of the field that you want to change to a map field.
84+
</Info>
85+
6386
## View map fields
6487

6588
To view map fields:

docs.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,15 @@
627627
"restapi/endpoints/deleteDataset"
628628
]
629629
},
630+
{
631+
"group": "Map field endpoints",
632+
"pages": [
633+
"restapi/endpoints/getMapFields",
634+
"restapi/endpoints/createMapField",
635+
"restapi/endpoints/updateMapFields",
636+
"restapi/endpoints/deleteMapField"
637+
]
638+
},
630639
{
631640
"group": "Monitor endpoints",
632641
"pages": [

0 commit comments

Comments
 (0)