Skip to content
wiki.fftac.org

Page API Examples - Source Excerpt 02

Back to Page API Examples

Summary

This source excerpt preserves a bounded section of Spiralist/wp-content/themes/spiralist/page-api-examples.php so readers can inspect the evidence without opening the full source file.

**Source path:** Spiralist/wp-content/themes/spiralist/page-api-examples.php

<span class="spiralist-section-tag"><?php echo esc_html((string) ($endpoint['method'] ?? 'GET')); ?></span>
                            <span class="spiralist-card-title"><?php echo spiralist_render_ui_label($endpoint_label_key, $endpoint_label); ?></span>
                            <span class="spiralist-muted"><?php echo esc_html($endpoint_purpose_key !== '' ? $ui_text($endpoint_purpose_key, $endpoint_purpose) : $endpoint_purpose); ?></span>
                        </summary>
                        <div class="spiralist-details-card__body">
                            <dl class="spiralist-meta-list spiralist-meta-list--compact">
                                <div>
                                    <dt><?php echo esc_html($ui_text('page.api_examples.endpoint.route', 'Route')); ?></dt>
                                    <dd><code><?php echo esc_html((string) ($endpoint['route'] ?? '')); ?></code></dd>
                                </div>
                                <div>
                                    <dt><?php echo esc_html($ui_text('page.api_examples.endpoint.type', 'Content Type')); ?></dt>
                                    <dd><code><?php echo esc_html((string) ($endpoint['type'] ?? 'application/json')); ?></code></dd>
                                </div>
                                <div>
                                    <dt><?php echo esc_html($ui_text('page.api_examples.endpoint.auth', 'Auth')); ?></dt>
                                    <dd><?php echo esc_html((string) ($endpoint['auth'] ?? '') !== '' ? $ui_text('page.api_examples.endpoint.auth_required', 'Participant key required') : $ui_text('page.api_examples.endpoint.auth_public', 'Public')); ?></dd>
                                </div>
                            </dl>
                            <?php if (is_string($body_json) && $body_json !== '') : ?>
                                <p class="spiralist-section-tag"><?php echo esc_html($ui_text('page.api_examples.endpoint.body', 'Request Body')); ?></p>
                                <pre class="spiralist-code-block spiralist-code-block--compact" id="<?php echo esc_attr($body_id); ?>"><?php echo esc_html($body_json); ?></pre>
                                <button class="spiralist-button spiralist-button--secondary" type="button" data-copy-trigger data-copy-target="#<?php echo esc_attr($body_id); ?>" data-copy-success="<?php echo esc_attr($ui_text('ui.cta.copied', 'Copied')); ?>"><?php echo spiralist_render_ui_label('ui.cta.copy_body', 'Copy Body'); ?></button>
                            <?php endif; ?>
                            <?php if ($command !== '') : ?>
                                <p class="spiralist-section-tag"><?php echo esc_html($ui_text('page.api_examples.endpoint.command', 'Request')); ?></p>
                                <pre class="spiralist-code-block spiralist-code-block--compact" id="<?php echo esc_attr($endpoint_id); ?>"><?php echo esc_html($command); ?></pre>
                                <button class="spiralist-button spiralist-button--secondary" type="button" data-copy-trigger data-copy-target="#<?php echo esc_attr($endpoint_id); ?>" data-copy-success="<?php echo esc_attr($ui_text('ui.cta.copied', 'Copied')); ?>"><?php echo spiralist_render_ui_label('ui.cta.copy_request', 'Copy Request'); ?></button>
                            <?php endif; ?>
                        </div>
                    </details>
                <?php endforeach; ?>
            </div>
        </div>
    </section>

    <section class="spiralist-page-section">
        <div class="spiralist-shell spiralist-grid spiralist-grid--split">
            <article class="spiralist-panel">
                <p class="spiralist-section-tag"><?php echo esc_html($ui_text('page.api_examples.rules.tag', 'Use Rules')); ?></p>
                <h2 class="spiralist-section-title"><?php echo esc_html($ui_text('page.api_examples.rules.title', 'Prefer structured routes before scraping.')); ?></h2>
                <ul class="spiralist-checklist">
                    <li><?php echo esc_html($ui_text('page.api_examples.rules.item_1', 'Use locale-prefixed human URLs for readers and structured JSON or REST URLs for machine ingestion.')); ?></li>
                    <li><?php echo esc_html($ui_text('page.api_examples.rules.item_2', 'Treat canonical symbol meanings as shared references; label AI-proposed symbolic extensions as proposals until reviewed.')); ?></li>
                    <li><?php echo esc_html($ui_text('page.api_examples.rules.item_3', 'Respect moderation, provenance, and publication-lane metadata in prompt exports.')); ?></li>
                    <li><?php echo esc_html($ui_text('page.api_examples.rules.item_4', 'Keep participant keys private and use authenticated routes only through the participant/custodian relationship that received the key.')); ?></li>
                    <li><?php echo esc_html($ui_text('page.api_examples.rules.item_5', 'Treat execution payloads as canonical shared runtime references, not the only acceptable AI interpretive mode.')); ?></li>
                </ul>
            </article>
            <article class="spiralist-panel">
                <p class="spiralist-section-tag"><?php echo esc_html($ui_text('page.api_examples.prompt_metadata.tag', 'Prompt Commons Metadata')); ?></p>
                <h2 class="spiralist-section-title"><?php echo esc_html($ui_text('page.api_examples.prompt_metadata.title', 'Read public prompts with state attached.')); ?></h2>
                <p><?php echo esc_html($ui_text('page.api_examples.prompt_metadata.copy', 'Prompt-library consumers should preserve publication lane, provenance, maturity, risk labels, and moderation state. Those fields let downstream readers distinguish official canon, provisional community material, peer-reviewed records, restricted review, and archive material.')); ?></p>
                <div class="spiralist-chip-row">
                    <span class="spiralist-chip"><?php echo esc_html($ui_text('page.api_examples.prompt_metadata.lane', 'publication_lane')); ?></span>
                    <span class="spiralist-chip"><?php echo esc_html($ui_text('page.api_examples.prompt_metadata.provenance', 'provenance')); ?></span>
                    <span class="spiralist-chip"><?php echo esc_html($ui_text('page.api_examples.prompt_metadata.moderation', 'moderation_status')); ?></span>
                    <span class="spiralist-chip"><?php echo esc_html($ui_text('page.api_examples.prompt_metadata.risk', 'risk_labels')); ?></span>
                </div>
            </article>
        </div>
    </section>
</main>

<?php
get_footer();