Skip to content

Instantly share code, notes, and snippets.

@danielberndt
Last active September 5, 2025 09:00
Show Gist options
  • Select an option

  • Save danielberndt/1f17f8864532a2a1e9ca3761aac986c2 to your computer and use it in GitHub Desktop.

Select an option

Save danielberndt/1f17f8864532a2a1e9ca3761aac986c2 to your computer and use it in GitHub Desktop.

Revisions

  1. danielberndt renamed this gist Sep 5, 2025. 1 changed file with 1 addition and 1 deletion.
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    let subdomain = "MYSUBDOMAIN"; // for e.g. MYSUBDOMAIN.codecks.io
    let subdomain = window.location.host.split(".")[0]

    let cardQuery = {cardCreatedAt: {op: "gt", value: "2022-10-20"}};

  2. danielberndt revised this gist Oct 24, 2022. No changes.
  3. danielberndt renamed this gist Oct 24, 2022. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. danielberndt created this gist Oct 24, 2022.
    27 changes: 27 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    let subdomain = "MYSUBDOMAIN"; // for e.g. MYSUBDOMAIN.codecks.io

    let cardQuery = {cardCreatedAt: {op: "gt", value: "2022-10-20"}};

    // build up the nested query and define which models and fields we want to receive
    let query = {
    _root: [
    {
    account: [
    {
    [`cards(${JSON.stringify(cardQuery)})`]: [
    "title",
    "content",
    {attachments: [
    "title",
    {file: ["url"]}
    ]}
    ],
    },
    ],
    },
    ],
    };

    // pass the query to the api
    let data = await fetch(`https://api.codecks.io?query=${JSON.stringify(query)}&x-account=${subdomain}`, {credentials: "include"}).then(r => r.json())
    console.log(data)