feat: méthode WebSocket HA pour Lovelace + vue lumières créée
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
---
|
||||
name: anytype
|
||||
description: Interact with Anytype knowledge base via self-hosted JSON API. Create, search, list and manage objects, spaces, types and lists.
|
||||
metadata:
|
||||
clawdbot:
|
||||
emoji: "🧠"
|
||||
---
|
||||
|
||||
# Anytype Integration
|
||||
|
||||
You have access to a self-hosted Anytype instance via its JSON API.
|
||||
|
||||
## Connection Details
|
||||
|
||||
- **Base URL**: `http://192.168.1.150:31009`
|
||||
- **Auth Header**: `Authorization: Bearer VVP91vUjVAPF4xcnDZF2p61kgxu+4M04n3CGj/mngtk=`
|
||||
- **Version Header**: `Anytype-Version: 2025-05-20`
|
||||
|
||||
Every request MUST include both headers. Use curl for all API calls.
|
||||
|
||||
## Common curl template
|
||||
```bash
|
||||
curl -s -X METHOD "http://192.168.1.150:31009/v1/ENDPOINT" \
|
||||
-H "Authorization: Bearer VVP91vUjVAPF4xcnDZF2p61kgxu+4M04n3CGj/mngtk=" \
|
||||
-H "Anytype-Version: 2025-05-20" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"key":"value"}'
|
||||
```
|
||||
|
||||
## Available Endpoints
|
||||
|
||||
### Spaces
|
||||
|
||||
- **List spaces**: `GET /v1/spaces`
|
||||
- **Get space**: `GET /v1/spaces/{space_id}`
|
||||
- **Get space members**: `GET /v1/spaces/{space_id}/members`
|
||||
|
||||
### Search
|
||||
|
||||
- **Global search**: `POST /v1/search` with body `{"query": "search term"}`
|
||||
- **Search in space**: `POST /v1/spaces/{space_id}/search` with body `{"query": "search term"}`
|
||||
|
||||
### Objects
|
||||
|
||||
- **List objects in space**: `GET /v1/spaces/{space_id}/objects`
|
||||
- **Get object**: `GET /v1/spaces/{space_id}/objects/{object_id}`
|
||||
- **Create object**: `POST /v1/spaces/{space_id}/objects` with body:
|
||||
```json
|
||||
{
|
||||
"name": "Object title",
|
||||
"icon": "📝",
|
||||
"body": "Content in markdown format",
|
||||
"type_key": "ot-page",
|
||||
"description": "Optional description"
|
||||
}
|
||||
```
|
||||
- **Update object**: `PATCH /v1/spaces/{space_id}/objects/{object_id}`
|
||||
- **Delete object**: `DELETE /v1/spaces/{space_id}/objects/{object_id}`
|
||||
|
||||
### Types
|
||||
|
||||
- **List types in space**: `GET /v1/spaces/{space_id}/types`
|
||||
- **Get type**: `GET /v1/spaces/{space_id}/types/{type_id}`
|
||||
|
||||
### Lists / Collections
|
||||
|
||||
- **List lists**: `GET /v1/spaces/{space_id}/lists`
|
||||
- **Get list content**: `GET /v1/spaces/{space_id}/lists/{list_id}`
|
||||
- **Add object to list**: `POST /v1/spaces/{space_id}/lists/{list_id}/objects` with body `{"object_id": "..."}`
|
||||
|
||||
### Properties / Relations
|
||||
|
||||
- **List properties**: `GET /v1/spaces/{space_id}/properties`
|
||||
|
||||
### Templates
|
||||
|
||||
- **List templates for type**: `GET /v1/spaces/{space_id}/types/{type_id}/templates`
|
||||
|
||||
## Workflow
|
||||
|
||||
1. **Always start by listing spaces** to get the space_id
|
||||
2. Then use the space_id in subsequent calls
|
||||
3. For creating objects, first list types to find the correct type_key
|
||||
4. Present results in a clean, readable format to the user
|
||||
5. When searching, use global search first, then refine by space if needed
|
||||
|
||||
## Error Handling
|
||||
|
||||
- 401: Token invalid or expired
|
||||
- 404: Object/space not found
|
||||
- 400: Bad request (check JSON body format)
|
||||
- If an endpoint returns an error, show the full response to help debug
|
||||
|
||||
## Important Notes
|
||||
|
||||
- The API is RESTful with JSON responses
|
||||
- All dates are in ISO 8601 format
|
||||
- Object content (body) uses Markdown
|
||||
- The type_key for common types: ot-page (Page), ot-task (Task), ot-note (Note), ot-bookmark (Bookmark)
|
||||
- Always use `-s` flag with curl to suppress progress bars
|
||||
- Pipe through `python3 -m json.tool` or `jq` for readable output when showing to user
|
||||
Reference in New Issue
Block a user