Create a Document
POST /{appname}/data/{servicename}
Having a datastore is great! Now you are ready to start adding documents to your store. The create document command will add a JSON document to your datastore.
Recommendations
- Create your own unique _id in your JSON document
- Use a field on each document to distinguish its type from other documents ie. type docType , etc.
Parameters
Path
- appname - string - the name of your hyper cloud application.
- servicename - string - the name of your hyper cloud service.
Request Body
After the Blueberry release on 1/17/2022, the id field will no longer be generated on your documents by the data service. Instead, the _id field will be generated, if your document does not already contain an _id. more...ο»Ώ
A JSON document with one to many fields. An _id field is allowed. If an _id is not provided, it will be generated on the document. Each field name must follow the following rules:
- must begin with a lowercase letter (a-z), unless it is the _id field.
- must be lowercase letters (a-z)
- digits (0-9)
- any of these characters _ $ + -
Request Payload Limit
When creating or updating a document within the Data service, the request body payload size limit for the Data service is 5MB.
Examples
Create a document in the datastore
Don't forget!
Be sure to set your HYPER environment variable with the value of your hyper app's connection string.
Responses
When making a request to this endpoint you can get the following responses returned:
Status Code | Description | Response |
201 | Successfully created document | {"ok": true, "id": "1234"} |
500 | An error occurred trying to create a document | {"ok": false, "msg": "..."} |
Need Help?
You can always reach out to our support team for any additional assistance on slack.
ο»Ώ
