pub(crate) async fn create_record(
__arg0: State<AppState>,
headers: HeaderMap,
__arg2: XrpcBody,
) -> ResponseExpand description
POST /xrpc/com.atproto.repo.createRecord
404 RepoNotFound when the repository is unknown, 400 when the collection
is not one this deployment defines, the record’s $type disagrees with it,
or the requested rkey is one the collection’s key strategy will not admit
; 400 InvalidSwap when the swapCommit named is not the commit the
repository is at. The key in the returned uri is the one the lexicon
decided, which is not always the one that was asked for. The response
carries the uri and the cid the lexicon requires; see
CreateRecordResponse.
§A key already in use is refused
This is createRecord, and in atproto createRecord creates: a key
already in use is a 400 and putRecord is the upsert. This server could not
tell the two apart while there was no CID to condition a refusal on. There
is one now, and compare-and-swap has landed. The write carries
Precondition::Absent, which is the same check every other
precondition goes through and is evaluated in the same place.
The refusal is InvalidRequest rather than the InvalidSwap the lexicon
declares, and for a reason about names: InvalidSwap tells a
client to re-read and retry, and this retry can never succeed. A caller
that meant to replace the record wants putRecord.