POST Request Body

Blueprints are created in 3 steps, starting with a test clock set at 2001-01-01 .At time 1 ( 2001-01-01 ), we create an Imgur Image entry. At time 2 ( 2001-01-02 ), we upload the blueprint string and receive a sha. At time 3 ( 2001-01-03 ), we upload the blueprint post. In this documentation, we'll focus on the third step.We create a blueprint post by POST ing to /api/blueprint/ . { "title": "Blueprint title", "blueprintString": { // The blueprintString.sha is a foreign key, pointing to the blueprint data we created at time 2. "sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595" }, "imgurImage": { // The imgurImage.imgurId is a foreign key, pointing to the Imgur Image data we created at time 1. "imgurId": "Imgur ID 1" }, "descriptionMarkdown": "Blueprint description markdown", // Blueprints can be tagged with multiple tags. Here we have a single tag, "belt balancer". "tags": [ { // This double nesting is how many-to-many relationships are represented. This object is the BlueprintTag mapping. "tag": { // This object is the tag. It's part of reference data that was created earlier. The (category, name) pair is the foreign key. "category": "belt", "name": "balancer" } } ] }

POST Response Body

The response includes all the properties we sent, along with server-generated information. { "key": "6ed1f638-a63c-3a54-af67-ba494f27bff2", "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null, "version": { "number": 1, "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null, "createdOn": "2001-01-03T23:59:59Z", "createdBy": { "userId": "User ID" }, "lastUpdatedBy": { "userId": "User ID" } }, "title": "Blueprint title", "voteSummary": { "numberOfUpvotes": 0, "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null }, "blueprintString": { "sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595", "createdOn": "2001-01-02T23:59:59Z", "createdBy": { "userId": "User ID" } }, "imgurImage": { "imgurId": "Imgur ID 1", "imgurType": "image/png", "height": 300, "width": 300, "systemFrom": "2001-01-01T23:59:59Z", "systemTo": null }, "descriptionMarkdown": "Blueprint description markdown", "tags": [ { "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null, "tag": { "category": "belt", "name": "balancer", "ordinal": 1, "systemFrom": "2000-01-01T00:00:00Z", "systemTo": null } } ] }

Temporal Response

Here's the same response, with some temporal features labeled. These will be covered in upcoming sections. { // The key is generated-server side. "key": "6ed1f638-a63c-3a54-af67-ba494f27bff2", // The systemFrom is the time we created the blueprint post time 3: 2001-01-03. "systemFrom": "2001-01-03T23:59:59Z", // The systemTo is null, or infinity, indicating this data is current. "systemTo": null, // The version object is covered in the section on Versioning. "version": { "number": 1, "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null, // The createdOn, createdBy, and lastUpdatedBy properties are covered in the section on Auditing. "createdOn": "2001-01-03T23:59:59Z", "createdBy": { "userId": "User ID" }, "lastUpdatedBy": { "userId": "User ID" } }, "title": "Blueprint title", "voteSummary": { "numberOfUpvotes": 0, "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null }, "blueprintString": { // The request only included blueprintString.sha, a foreign key. The response includes the whole object. "sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595", // We created the blueprint data at time 2: 2001-01-02. "createdOn": "2001-01-02T23:59:59Z", "createdBy": { "userId": "User ID" } }, "imgurImage": { // The request only included the imgurImage.id, a foreign key. The response includes the whole object. "imgurId": "Imgur ID 1", "imgurType": "image/png", "height": 300, "width": 300, // We created the Imugr image at time 1: 2001-01-01. "systemFrom": "2001-01-01T23:59:59Z", "systemTo": null }, "descriptionMarkdown": "Blueprint description markdown", "tags": [ { // The BlueprintTag mapping was created along with the blueprint post at time 3: 2001-01-03. "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null, "tag": { // The request only included tag.category and tag.name, the composite foreign key. The response includes the whole object. "category": "belt", "name": "balancer", "ordinal": 1, // It was created a year earlier than the Blueprint. "systemFrom": "2000-01-01T00:00:00Z", "systemTo": null } } ] }

Non-destructive updates

Next, we update the blueprint by PATCH ing /api/blueprint/{id}?version=1 .

Response

The response includes the updated properties we sent, plus our first temporal updates.The edits are reflected at time 4 ( 2001-01-04 ). { "key": "6ed1f638-a63c-3a54-af67-ba494f27bff2", - "systemFrom": "2001-01-03T23:59:59Z", + "systemFrom": "2001-01-04T23:59:59Z", "systemTo": null, "version": { - "number": 1, - "systemFrom": "2001-01-03T23:59:59Z", + "number": 2, + "systemFrom": "2001-01-04T23:59:59Z", "systemTo": null, "createdOn": "2001-01-03T23:59:59Z", "createdBy": { "userId": "User ID" }, "lastUpdatedBy": { "userId": "User ID" } }, - "title": "Blueprint title", + "title": "Edited blueprint title", "voteSummary": { "numberOfUpvotes": 0, "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null }, "blueprintString": { "sha": "cc341849b4086ce7b1893b366b0dc8e99ce4e595", "createdOn": "2001-01-02T23:59:59Z", "createdBy": { "userId": "User ID" } }, "imgurImage": { "imgurId": "Imgur ID 1", "imgurType": "image/png", "height": 300, "width": 300, "systemFrom": "2001-01-01T23:59:59Z", "systemTo": null }, - "descriptionMarkdown": "Blueprint description markdown", + "descriptionMarkdown": "Edited Blueprint description markdown", "tags": [ { "tagCategory": "belt", "tagName": "balancer", "systemFrom": "2001-01-03T23:59:59Z", "systemTo": null, "tag": { "category": "belt", "name": "balancer", "ordinal": 1, "systemFrom": "2000-01-01T00:00:00Z", "systemTo": null } } ] }

As-of query

In the next section, we'll perform our first as-of query to prove to ourselves that no data has been lost.