generic

CREATE: Inserts a new document into the collection

Using this operation you can insert new documents into collection. Normally the operation ends with 201 HTTP status code, Last-Modified and Location headers specified. identifier is included in response body or it can be parsed from the Location response header.

When the document to post is marked as a duplicate (using rules described at API3_DEDUP_FALLBACK_ENABLED switch), the update operation takes place instead of inserting. In this case the original document in the collection is found and it gets updated by the actual operation POST body. Finally the operation ends with 200 HTTP status code along with Last-Modified and correct Location headers. The response body then includes isDeduplication=true and deduplicatedIdentifier fields.

This operation provides autopruning of the collection (if autopruning is enabled).

This operation requires create (and/or update for deduplication) permission for the API and the collection (e.g. api:treatments:create and api:treatments:update)

post/{collection}

Request body

OR
OR
OR
OR
OR

Example request

{
  "identifier": "53409478-105f-11e9-ab14-d663bd873d93",
  "date": 1525383610088,
  "utcOffset": 120,
  "app": "xdrip",
  "device": "dexcom G5",
  "_id": "58e9dfbc166d88cc18683aac",
  "srvCreated": 1525383610088,
  "subject": "uploader",
  "srvModified": 1525383610088,
  "modifiedBy": "admin",
  "isReadOnly": true
}

Response

Successfully updated a duplicate document in the collection

statusinteger
identifierstring

Identifier of created or modified document

isDeduplicationboolean

Flag whether the operation found a duplicate document (to update)

deduplicatedIdentifierstring

The original document that has been marked as a duplicate document and which has been updated

Example response

{
  "status": 200,
  "identifier": "53409478-105f-11e9-ab14-d663bd873d93",
  "isDeduplication": true,
  "deduplicatedIdentifier": "abc09478-105f-11e9-ab14-d663bd873d93"
}

Changes

Changed in 4 of the 6 revisions of this API.7625

    • the endpoint scheme security accessToken was removed from the API

      api-security-removed

    This revision also has 1 change that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog

  • 8252719e8e34110See the full diff
    • removed the success response with the status 204

      response-success-status-removed

    • the endpoint scheme security accessToken was added to the API

      api-security-added

    • the endpoint scheme security jwtoken was added to the API

      api-security-added

    • the endpoint scheme security apiKeyAuth was removed from the API

      api-security-removed

    • added the media type application/json for the response with the status 201

      response-media-type-added

    • added the media type application/json for the response with the status 400

      response-media-type-added

    • added the media type application/json for the response with the status 401

      response-media-type-added

    • added the media type application/json for the response with the status 403

      response-media-type-added

    • added the media type application/json for the response with the status 404

      response-media-type-added

    • added the media type application/json for the response with the status 422

      response-media-type-added

    • added the success response with the status 200

      response-success-status-added

    • added the new optional request property oneOf[DeviceStatus]/allOf[DocumentBase]/isReadOnly

      new-optional-request-property

    • added the new optional request property oneOf[Entry]/allOf[DocumentBase]/isReadOnly

      new-optional-request-property

    • added the new optional request property oneOf[Food]/allOf[DocumentBase]/isReadOnly

      new-optional-request-property

    • added the new optional request property oneOf[Profile]/allOf[DocumentBase]/isReadOnly

      new-optional-request-property

    • added the new optional request property oneOf[Settings]/allOf[DocumentBase]/isReadOnly

      new-optional-request-property

    • added the new optional request property oneOf[Treatment]/allOf[DocumentBase]/isReadOnly

      new-optional-request-property

    • added the non-success response with the status 422

      response-non-success-status-added

  • e3a793475629667See the full diff
    • removed the media type application/json for the response with the status 201

      response-media-type-removed

    • removed the media type application/json for the response with the status 400

      response-media-type-removed

    • removed the media type application/json for the response with the status 401

      response-media-type-removed

    • removed the media type application/json for the response with the status 403

      response-media-type-removed

    • removed the media type application/json for the response with the status 404

      response-media-type-removed

    • removed the success response with the status 200

      response-success-status-removed

    • removed the request property oneOf[DeviceStatus]/allOf[DocumentBase]/isReadOnly

      request-property-removed

    • removed the request property oneOf[Entry]/allOf[DocumentBase]/isReadOnly

      request-property-removed

    • removed the request property oneOf[Food]/allOf[DocumentBase]/isReadOnly

      request-property-removed

    • removed the request property oneOf[Profile]/allOf[DocumentBase]/isReadOnly

      request-property-removed

    • removed the request property oneOf[Settings]/allOf[DocumentBase]/isReadOnly

      request-property-removed

    • removed the request property oneOf[Treatment]/allOf[DocumentBase]/isReadOnly

      request-property-removed

    • the endpoint scheme security apiKeyAuth was added to the API

      api-security-added

    • the endpoint scheme security jwtoken was removed from the API

      api-security-removed

    • added the new optional header request parameter Date to all path's operations

      new-optional-request-default-parameter-to-existing-path

    • added the new optional query request parameter now to all path's operations

      new-optional-request-default-parameter-to-existing-path

    • added the new optional query request parameter token to all path's operations

      new-optional-request-default-parameter-to-existing-path

    • removed the non-success response with the status 422

      response-non-success-status-removed

    • added the success response with the status 204

      response-success-status-added

    This revision also has 8 changes that name no endpoint, such as unreferenced schemas being removed. See the revision's changelog