POST /api/v1/measurements ​

operationId: measureEntities

This operation is described by the generated OpenAPI contract.

Authentication ​

Provide either authentication method:

  • Bearer token (Authorization: Bearer <token>).
  • API token in the X-SketchForge-Token header.

Parameters ​

NameInRequiredSchemaDescription
projectIdqueryYes{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]*$","maxLength":120}—

Request body ​

Required.

application/json ​

json
{
  "type": "object",
  "required": [
    "from",
    "to"
  ],
  "properties": {
    "from": {
      "oneOf": [
        {
          "type": "object",
          "not": {
            "type": "object",
            "required": [
              "entity"
            ]
          },
          "required": [
            "shapeId"
          ],
          "properties": {
            "shapeId": {
              "type": "string",
              "pattern": "\\S",
              "description": "Whitespace is trimmed; the remaining value must not be empty."
            }
          }
        },
        {
          "type": "object",
          "required": [
            "shapeId",
            "entity"
          ],
          "properties": {
            "shapeId": {
              "type": "string",
              "pattern": "\\S"
            },
            "entity": {
              "type": "string",
              "enum": [
                "shape"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "shapeId",
            "entity",
            "index"
          ],
          "properties": {
            "shapeId": {
              "type": "string",
              "pattern": "\\S"
            },
            "entity": {
              "type": "string",
              "enum": [
                "edge",
                "face"
              ]
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "description": "Zero-based edge or face index."
            }
          }
        }
      ]
    },
    "to": {
      "oneOf": [
        {
          "type": "object",
          "not": {
            "type": "object",
            "required": [
              "entity"
            ]
          },
          "required": [
            "shapeId"
          ],
          "properties": {
            "shapeId": {
              "type": "string",
              "pattern": "\\S",
              "description": "Whitespace is trimmed; the remaining value must not be empty."
            }
          }
        },
        {
          "type": "object",
          "required": [
            "shapeId",
            "entity"
          ],
          "properties": {
            "shapeId": {
              "type": "string",
              "pattern": "\\S"
            },
            "entity": {
              "type": "string",
              "enum": [
                "shape"
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "shapeId",
            "entity",
            "index"
          ],
          "properties": {
            "shapeId": {
              "type": "string",
              "pattern": "\\S"
            },
            "entity": {
              "type": "string",
              "enum": [
                "edge",
                "face"
              ]
            },
            "index": {
              "type": "integer",
              "minimum": 0,
              "description": "Zero-based edge or face index."
            }
          }
        }
      ]
    }
  }
}

Responses ​

200 — Successful response. ​

Content type: application/json

json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "distance",
        "angleDegrees",
        "angleUnavailable"
      ],
      "properties": {
        "distance": {
          "type": "number",
          "minimum": 0
        },
        "angleDegrees": {
          "type": "number",
          "minimum": 0,
          "maximum": 180
        },
        "angleUnavailable": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            null
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "distance",
        "angleDegrees",
        "angleUnavailable"
      ],
      "properties": {
        "distance": {
          "type": "number",
          "minimum": 0
        },
        "angleDegrees": {
          "type": [
            "number",
            "null"
          ],
          "enum": [
            null,
            null
          ]
        },
        "angleUnavailable": {
          "type": "string",
          "enum": [
            "notPlanar",
            "degenerateNormal"
          ]
        }
      }
    }
  ]
}

400 — Invalid request. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "invalid_project_id",
        "invalid_body",
        "invalid_request"
      ]
    }
  },
  "additionalProperties": false
}

401 — Authentication failed. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "unauthorized"
      ]
    }
  },
  "additionalProperties": false
}

404 — Resource not found or API disabled. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "api_disabled",
        "project_not_found",
        "shape_not_found"
      ]
    }
  },
  "additionalProperties": false
}

409 — The project is busy or the request conflicts with current state. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "project_busy",
        "revision_mismatch"
      ]
    },
    "revision": {
      "type": "number"
    }
  },
  "additionalProperties": false
}

413 — Request exceeds the supported size or item limit. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "api_disabled",
        "unauthorized",
        "storage_unconfigured",
        "invalid_project_id",
        "invalid_shape_id",
        "invalid_body",
        "invalid_request",
        "project_not_found",
        "project_exists",
        "project_busy",
        "revision_mismatch",
        "shape_not_found",
        "shape_locked",
        "unsupported_kind",
        "unsupported_format",
        "unapplicable_fields",
        "too_many_shapes",
        "limit_exceeded",
        "geometry_failed",
        "cad_failed",
        "internal_error"
      ]
    },
    "revision": {
      "type": "number"
    }
  },
  "additionalProperties": true
}

422 — Request is valid JSON but cannot be applied. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "cad_failed"
      ]
    }
  },
  "additionalProperties": false
}

500 — Server-side failure. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "cad_failed",
        "internal_error"
      ]
    }
  },
  "additionalProperties": false
}

503 — Server-side failure. ​

Content type: application/json

json
{
  "type": "object",
  "required": [
    "error",
    "code"
  ],
  "properties": {
    "error": {
      "type": "string"
    },
    "code": {
      "type": "string",
      "enum": [
        "storage_unconfigured"
      ]
    }
  },
  "additionalProperties": false
}

Source ​

Route handler source · OpenAPI JSON · REST API guide


Documentation version: 1.30.0 · Repository revision: 1cb9fee8dff4d394684c229dd67a21da539d167f · View source