# ai.newnal.illi.schedule.putEntry

> Root or main admin creates or replaces a schedule entry for one or both parents (feature spec A-E04-18). Writes a profileScheduleActivities record in each named parent's repo (the same rkey when creating for both, and one group) with its provenance, and ILLI's scheduleExtra next to it; recomputes the occurrences. Category defaults (reminders, grade, template) are the app's; the server stores what it receives. A lunar yearly entry carries recurrenceRule RSCALE=DANGI;FREQ=YEARLY and the server resolves its dates. SKIP in the rule follows RFC 7529 with the platform's default OMIT (a day the month lacks is skipped); write RSCALE=GREGORIAN;SKIP=BACKWARD for the last day instead. The card image is the record's image in each parent's repo (schedule.uploadImage).

- Kind: procedure
- Authority: schedule.illi.newnal.ai
- Lexicon: 1
- Published by [illi-service.newnal.id](https://lexicon.garden/identity/did:plc:uztm7bi2ce42dez3uu3qafro), the NSID's authority

## Links

- [Documentation](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.schedule.putEntry)
- [Schema JSON](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.schedule.putEntry/schema.json)
- [Analytics](https://lexicon.garden/lexicon/did:plc:uztm7bi2ce42dez3uu3qafro/ai.newnal.illi.schedule.putEntry/analytics)

## Procedure (`ai.newnal.illi.schedule.putEntry`)

Type: procedure · POST

### Input (application/json)

- `blank` (string, required)
  - Constraints: maxLength: 600, maxGraphemes: 60
- `category` (ref, required)
  - Reference: `ai.newnal.illi.schedule.defs#category`
- `clearImage` (boolean)
- `description` (string)
  - Constraints: maxLength: 3000, maxGraphemes: 300
- `expectedCid` (string · cid)
- `grade` (ref, required)
  - Reference: `ai.newnal.illi.schedule.defs#grade`
- `homeId` (string · tid, required)
- `location` (string)
  - Constraints: maxLength: 1000, maxGraphemes: 100
- `occurrenceStartAt` (string · datetime): The occurrence scope this or following applies to (its startAt).
- `recurrenceRule` (string)
  - Constraints: maxLength: 256
- `relatedRecords` (array)
  - Constraints: maxLength: 10
  - `items` (string · at-uri)
- `reminderTime` (string)
  - Constraints: maxLength: 5
- `reminders` (array, required)
  - Constraints: maxLength: 10
  - `items` (string)
    - Constraints: maxLength: 32
- `requestKey` (string, required): Idempotency key chosen by the client; a replay with the same key and input returns the first result.
  - Constraints: minLength: 1, maxLength: 64
- `rkey` (string · record-key): Present when replacing an existing entry.
- `scope` (string): When rkey names a recurring entry: all replaces it; this detaches the occurrence at occurrenceStartAt as a one-off entry with the new fields (the series skips that occurrence); following ends the series the day before occurrenceStartAt and starts a new entry from it with the new fields. The detached or new entry comes back with its own rkey.
  - Constraints: default: "all", knownValues: all | this | following
- `slots` (array, required)
  - Constraints: minLength: 1, maxLength: 2
  - `items` (integer): The parent slot, 1 or 2.
    - Constraints: minimum: 1, maximum: 2
- `startTimes` (array): HH:MM in the entry's zone: a timed entry that rings several times a day (a medication morning and evening); the entry's own time of day is one of them and the rule then decides the dates only.
  - Constraints: maxLength: 24
  - `items` (string)
    - Constraints: maxLength: 5
- `time` (ref, required)
  - Reference: `ai.newnal.illi.schedule.defs#time`
- `title` (string, required): The completed sentence shown on the device.
  - Constraints: maxLength: 1200, maxGraphemes: 120

### Output (application/json)

- `entries` (array, required)
  - `items` (ref)
    - Reference: `ai.newnal.illi.schedule.defs#entryView`

### Errors

- `NotMember`: No description in schema.
- `NotAdmin`: No description in schema.
- `HomeNotFound`: No description in schema.
- `ParentNotLinked`: No description in schema.
- `EntryNotFound`: No description in schema.
- `InvalidRecord`: No description in schema.
- `RecordChanged`: No description in schema.
- `DelegationUnavailable`: No description in schema.
- `PdsUnavailable`: No description in schema.
- `RequestConflict`: No description in schema.

## Schema

```json
{
  "$type": "com.atproto.lexicon.schema",
  "defs": {
    "main": {
      "description": "Root or main admin creates or replaces a schedule entry for one or both parents (feature spec A-E04-18). Writes a profileScheduleActivities record in each named parent's repo (the same rkey when creating for both, and one group) with its provenance, and ILLI's scheduleExtra next to it; recomputes the occurrences. Category defaults (reminders, grade, template) are the app's; the server stores what it receives. A lunar yearly entry carries recurrenceRule RSCALE=DANGI;FREQ=YEARLY and the server resolves its dates. SKIP in the rule follows RFC 7529 with the platform's default OMIT (a day the month lacks is skipped); write RSCALE=GREGORIAN;SKIP=BACKWARD for the last day instead. The card image is the record's image in each parent's repo (schedule.uploadImage).",
      "errors": [
        {
          "name": "NotMember"
        },
        {
          "name": "NotAdmin"
        },
        {
          "name": "HomeNotFound"
        },
        {
          "name": "ParentNotLinked"
        },
        {
          "name": "EntryNotFound"
        },
        {
          "name": "InvalidRecord"
        },
        {
          "name": "RecordChanged"
        },
        {
          "name": "DelegationUnavailable"
        },
        {
          "name": "PdsUnavailable"
        },
        {
          "name": "RequestConflict"
        }
      ],
      "input": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "blank": {
              "maxGraphemes": 60,
              "maxLength": 600,
              "type": "string"
            },
            "category": {
              "ref": "ai.newnal.illi.schedule.defs#category",
              "type": "ref"
            },
            "clearImage": {
              "type": "boolean"
            },
            "description": {
              "maxGraphemes": 300,
              "maxLength": 3000,
              "type": "string"
            },
            "expectedCid": {
              "format": "cid",
              "type": "string"
            },
            "grade": {
              "ref": "ai.newnal.illi.schedule.defs#grade",
              "type": "ref"
            },
            "homeId": {
              "format": "tid",
              "type": "string"
            },
            "location": {
              "maxGraphemes": 100,
              "maxLength": 1000,
              "type": "string"
            },
            "occurrenceStartAt": {
              "description": "The occurrence scope this or following applies to (its startAt).",
              "format": "datetime",
              "type": "string"
            },
            "recurrenceRule": {
              "maxLength": 256,
              "type": "string"
            },
            "relatedRecords": {
              "items": {
                "format": "at-uri",
                "type": "string"
              },
              "maxLength": 10,
              "type": "array"
            },
            "reminderTime": {
              "maxLength": 5,
              "type": "string"
            },
            "reminders": {
              "items": {
                "maxLength": 32,
                "type": "string"
              },
              "maxLength": 10,
              "type": "array"
            },
            "requestKey": {
              "description": "Idempotency key chosen by the client; a replay with the same key and input returns the first result.",
              "maxLength": 64,
              "minLength": 1,
              "pattern": "^[A-Za-z0-9._:-]+$",
              "type": "string"
            },
            "rkey": {
              "description": "Present when replacing an existing entry.",
              "format": "record-key",
              "type": "string"
            },
            "scope": {
              "default": "all",
              "description": "When rkey names a recurring entry: all replaces it; this detaches the occurrence at occurrenceStartAt as a one-off entry with the new fields (the series skips that occurrence); following ends the series the day before occurrenceStartAt and starts a new entry from it with the new fields. The detached or new entry comes back with its own rkey.",
              "knownValues": [
                "all",
                "this",
                "following"
              ],
              "type": "string"
            },
            "slots": {
              "items": {
                "description": "The parent slot, 1 or 2.",
                "maximum": 2,
                "minimum": 1,
                "type": "integer"
              },
              "maxLength": 2,
              "minLength": 1,
              "type": "array"
            },
            "startTimes": {
              "description": "HH:MM in the entry's zone: a timed entry that rings several times a day (a medication morning and evening); the entry's own time of day is one of them and the rule then decides the dates only.",
              "items": {
                "maxLength": 5,
                "type": "string"
              },
              "maxLength": 24,
              "type": "array"
            },
            "time": {
              "ref": "ai.newnal.illi.schedule.defs#time",
              "type": "ref"
            },
            "title": {
              "description": "The completed sentence shown on the device.",
              "maxGraphemes": 120,
              "maxLength": 1200,
              "type": "string"
            }
          },
          "required": [
            "homeId",
            "slots",
            "category",
            "blank",
            "title",
            "time",
            "reminders",
            "grade",
            "requestKey"
          ],
          "type": "object"
        }
      },
      "output": {
        "encoding": "application/json",
        "schema": {
          "properties": {
            "entries": {
              "items": {
                "ref": "ai.newnal.illi.schedule.defs#entryView",
                "type": "ref"
              },
              "type": "array"
            }
          },
          "required": [
            "entries"
          ],
          "type": "object"
        }
      },
      "type": "procedure"
    }
  },
  "id": "ai.newnal.illi.schedule.putEntry",
  "lexicon": 1
}
```
