Skip to content

Create guide to list and update identifiers#169

Merged
aviau merged 1 commit intoFlared:mainfrom
sebastiendeschambault-flare:sebastien/create-guide-to-list-and-update-identifiers
Feb 4, 2026
Merged

Create guide to list and update identifiers#169
aviau merged 1 commit intoFlared:mainfrom
sebastiendeschambault-flare:sebastien/create-guide-to-list-and-update-identifiers

Conversation

@sebastiendeschambault-flare
Copy link
Contributor

@sebastiendeschambault-flare sebastiendeschambault-flare commented Feb 4, 2026

Guide:
Screenshot 2026-02-04 at 3 53 05 PM

Here's the copy pasted python example, I tested the script to update the name of some identifiers:

import time

from flareio import FlareApiClient

api_client = FlareApiClient.from_env()

last_from: str | None = None

# 1. List all identifiers
for resp in api_client.scroll(
    method="GET",
    url="/firework/v3/identifiers/",
    params={
        "from": last_from,
        "size": 20,
    },
):
    # Rate limiting (default).
    time.sleep(0.25)

    data = resp.json()
    items = data.get("items", [])
    last_from = data.get("next") or last_from

    for item in items:
        # Rate limiting (default).
        time.sleep(0.25)

        identifier_id = item.get("id")

        # 2. Get the full identifier by ID
        identifier_resp = api_client.get(f"/firework/v3/identifiers/{identifier_id}")
        identifier = identifier_resp.json().get("identifier")

        # Rate limiting (default).
        time.sleep(0.25)

        # 3. Do the necessary updates to the identifier
        api_client.put(
            f"/firework/v2/assets/{identifier_id}",
            json={
                "name": identifier.get("name", "")
                + " (updated)",  # Example: update name or other fields
                "type": identifier.get("type"),  # Required
                "data": identifier.get("data"),  # Required
                # Include other fields from the Identifier schema as needed
            },
        )
        print(f"Updated identifier {identifier_id}")

@sebastiendeschambault-flare sebastiendeschambault-flare force-pushed the sebastien/create-guide-to-list-and-update-identifiers branch 4 times, most recently from d76dcf8 to a2e6a50 Compare February 4, 2026 20:50

api_client = FlareApiClient.from_env()

last_from: str | None = None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?


data = resp.json()
items = data.get("items", [])
last_from = data.get("next") or last_from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this?

method="GET",
url="/firework/v3/identifiers/",
params={
"from": last_from,
Copy link
Member

@aviau aviau Feb 4, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set to

        "from": None,

@sebastiendeschambault-flare sebastiendeschambault-flare force-pushed the sebastien/create-guide-to-list-and-update-identifiers branch from a2e6a50 to 7664ed6 Compare February 4, 2026 21:01
@sebastiendeschambault-flare
Copy link
Contributor Author

updated script:

import time

from flareio import FlareApiClient

api_client = FlareApiClient.from_env()

# 1. List all identifiers
for resp in api_client.scroll(
    method="GET",
    url="/firework/v3/identifiers/",
):
    # Rate limiting (default).
    time.sleep(0.25)

    data = resp.json()
    items = data.get("items", [])

    for item in items:
        # Rate limiting (default).
        time.sleep(0.25)

        identifier_id = item.get("id")

        # 2. Get the full identifier by ID
        identifier_resp = api_client.get(f"/firework/v3/identifiers/{identifier_id}")
        identifier = identifier_resp.json().get("identifier")

        # Rate limiting (default).
        time.sleep(0.25)

        # 3. Do the necessary updates to the identifier
        api_client.put(
            f"/firework/v2/assets/{identifier_id}",
            json={
                "name": identifier.get("name", "")
                + " (updated)",  # Example: update name or other fields
                "type": identifier.get("type"),  # Required
                "data": identifier.get("data"),  # Required
                # Include other fields from the Identifier schema as needed
            },
        )
        print(f"Updated identifier {identifier_id}")

@aviau aviau merged commit 315e6fa into Flared:main Feb 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants