Skip to content

Create or update account metadata

Creates or updates account metadata.

Authentication required

Requires account user level access or CAN_MUTATE_METADATA permission.

Arguments

Returns

1
2
3
4
5
6
7
8
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
 }
1
2
3
4
5
6
7
# Input variables for ACCOUNT
"input": {
    "linkedObjectType": ACCOUNT,
    "identifier": "A-12345",
    "key": "SOME_CONSTANT_KEY",
    "value": '{"some_key": "some_value", "another_key": "another_value"}',
}
1
2
3
4
5
6
7
# Input variables for ACCOUNT USER
"input": {
    "linkedObjectType": ACCOUNT_NUMBER,
    "identifier": "some_cool_account_user_email@example.com",
    "key": "SOME_CONSTANT_KEY",
    "value": '{"some_key": "some_value", "another_key": "another_value"}'
}

Examples

Add metadata for account (preferred)

1
2
3
4
5
6
7
8
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
1
2
3
4
5
6
"input": {
    "linkedObjectType": "ACCOUNT",
    "identifier": "A-154321",
    "key": "some_unique_key",
    "value": "{"pet_type": "dog", "name": "fang"}"
}
import json

import pprint

import requests

# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
    "Authorization": f"JWT {JWT_TOKEN}"
}

MUTATION = """
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
"""

VARIABLES = {
    "input": {
        "linkedObjectType": "ACCOUNT",
        "identifier": "A-154321",
        "key": "some_unique_key",
        "value": json.dumps({"pet_type": "dog", "name": "fang"})
    }
}

session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
    url=API_URL,
    json={"query": MUTATION, "variables": VARIABLES}
)
pprint.pprint(response.json())
const axios = require("axios")

// const apiUrl = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {
  "Authorization": `JWT ${jwtToken}`
}

const mutation = `
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
`

const variables = {
      "input": {
        "linkedObjectType": "ACCOUNT",
        "identifier": "A-154321",
        "key": "some_unique_key",
        "value": JSON.stringify({"pet_type": "dog", "name": "fang"})
      }
}

axios({
  url: apiUrl,
  method: "post",
  data: {
    query: mutation,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
import axios from 'axios';

// const API_URL = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
export const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

export const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {"Authorization": `JWT ${jwtToken}`}

export const mutation = `
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
`

export const variables = {
  "input": {
    "linkedObjectType": "ACCOUNT",
    "identifier": "A-154321",
    "key": "some_unique_key",
    "value": JSON.stringify({"pet_type": "dog", "name": "fang"})
  }
}

axios({
  url: apiUrl,
  method: "post",
  data: {
    query: mutation,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
{
    "data": {
        "updateMetadata": {
        "metadata": {
                "key": "some_unique_key",
                "value": '{"pet_type": "dog", "name": "fang"}'
            }
        }
    }
}

Add metadata for the account user

1
2
3
4
5
6
7
8
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
1
2
3
4
5
6
7
# Input variables
"input": {
    "linkedObjectType": "ACCOUNT_USER",
    "identifier": "some.test@email.com",
    "key": "some_unique_key",
    "value": '{"pet_type": "dog", "name": "fang"}'
}
import json

import pprint

import requests

# API_URL = "https://api.oeus-kraken.energy/v1/graphql/" # prod
API_URL = "https://api.oeus-kraken.systems/v1/graphql/" # test
JWT_TOKEN = "PLACE_JWT_TOKEN_HERE"
HEADERS = {
    "Authorization": f"JWT {JWT_TOKEN}"
}

MUTATION = """
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
"""

VARIABLES = {
    "input": {
        "linkedObjectType": "ACCOUNT_USER",
        "identifier": "some.test@email.com",
        "key": "some_unique_key",
        "value": json.dumps({"pet_type": "dog", "name": "fang"})
    }
}

session = requests.Session()
session.headers.update(HEADERS)
response = session.post(
    url=API_URL,
    json={"query": MUTATION, "variables": VARIABLES}
)
pprint.pprint(response.json())
const axios = require("axios")

// const apiUrl = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {
  "Authorization": `JWT ${jwtToken}`
}

const mutation = `
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
`

const variables = {
      "input": {
        "linkedObjectType": "ACCOUNT_USER",
        "identifier": "some.test@email.com",
        "key": "some_unique_key",
        "value": JSON.stringify({"pet_type": "dog", "name": "fang"})
      }
}

axios({
  url: apiUrl,
  method: "post",
  data: {
    query: mutation,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
import axios from 'axios';

// const API_URL = "https://api.oeus-kraken.energy/v1/graphql/" // Prod
export const apiUrl = "https://api.oeus-kraken.systems/v1/graphql/" // Test

export const jwtToken = "PLACE_JWT_TOKEN_HERE"

let headers = {"Authorization": `JWT ${jwtToken}`}

export const mutation = `
mutation updateMetadata($input: MetadataInput!) {
     updateMetadata(input: $input) {
         metadata {
            key
            value
         }
     }
}
`

export const variables = {
  "input": {
    "linkedObjectType": "ACCOUNT_USER",
    "identifier": "some.test@email.com",
    "key": "some_unique_key",
    "value": JSON.stringify({"pet_type": "dog", "name": "fang"})
  }
}

axios({
  url: apiUrl,
  method: "post",
  data: {
    query: mutation,
    variables: variables,
  },
  headers: headers,
}).then((response) => {
  console.log(JSON.stringify(response.data, null, 4));
});
{
    "data": {
        "updateMetadata": {
            "metadata": {
                "key": "some_unique_key",
                "value": '{"pet_type": "dog", "name": "fang"}'
            }
        }
    }
}
Back to top