Skip to main content

Read document or record

Motivation

Read CDoc/WDoc/CRecord/WRecord using API

Functional design

GET /api/v2/apps/{owner}/{app}/workspaces/{wsid}/docs/{pkg}.{table}/{id}

Headers

KeyValue
AuthorizationBearer {PrincipalToken}

Parameters

ParameterTypeDescription
ownerstringname of a user who owns the application
appstringname of an application
wsidint64the ID of workspace
pkg, tablestringidentifies a table (document or record)
idint64ID of a document or record

The following query constraints can be used:

  • include (respects permission on reading from the table or a container)
  • keys

Result

CodeDescriptionBody
200OKCDoc/WDoc/CRecord/WRecord object
400Bad requeseterror object
403Forbiddenerror object
404Document not founderror object

Technical design

Components

  • pkg/processors/query2
    • IApiPathHandler implementation for handling ApiPath_Docs
      • ~cmp.docsHandler~covrd1
    • newQueryProcessorPipeline: provide API handler for ApiPath_Docs
      • ~cmp.provideDocsHandler~covrd2
    • check ACL when including referenced objects and/or containers ~cmp.includeCheckACL~uncvrd3
  • pkg/sys/it
    • integration test for /docs/
      • ~it.TestQueryProcessor2_Docs~covrd4

Footnotes

  1. [~server.apiv2.docs/cmp.docsHandler~impl] pkg/processors/query2/impl_docs_handler.go:20:impl

  2. [~server.apiv2.docs/cmp.provideDocsHandler~impl] pkg/processors/query2/impl.go:129:impl

  3. [~server.apiv2.docs/cmp.includeCheckACL~impl]

  4. [~server.apiv2.docs/it.TestQueryProcessor2_Docs~impl] pkg/sys/it/impl_qpv2_test.go:2410:impl