Skip to main content

Quick Start Guide

Get started with ObjectWeaver's API in minutes. This guide covers the basics and points you to detailed examples for advanced features.

Overview

ObjectWeaver provides a REST API for generating structured JSON objects with AI. Define your schema, and get back exactly the data you need.

Your First Request

Here's a simple example to get you started:

curl -X POST http://localhost:2008/api/objectGen \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{
"prompt": "Create a technological landscape for a fantasy world",
"definition": {
"type": "object",
"instruction": "Defines the technological landscape of the world, including its level of advancement and notable innovations.",
"properties": {
"Level": {
"type": "string",
"instruction": "Categorize the overall technological sophistication of the world, such as medieval, industrial, or advanced futuristic."
},
"Inventions": {
"type": "string",
"instruction": "Describe the most significant technological discoveries and their transformative impact on the society, economy, and daily life."
}
}
}
}'

Key Components

  • Endpoint: http://localhost:2008/objectGen
  • Method: POST
  • Headers:
    • Content-Type: application/json
    • Authorization: Bearer YOUR_API_KEY
  • Body: JSON definition with prompt and schema
tip

Replace YOUR_API_KEY with your actual API key before making the request.

Authentication

Include your API key in the Authorization header:

-H "Authorization: Bearer YOUR_API_KEY"
info

You can configure authentication in your ObjectWeaver instance. See the Docker Setup Guide for details.

Error Handling

ObjectWeaver returns standard HTTP status codes:

CodeMeaning
200Success
400Bad Request - Invalid schema or request
401Unauthorized - Invalid or missing API key
429Rate Limit Exceeded
500Internal Server Error

Getting Help