Skip to content

API overview ​

The CoCoCo console is built on a GraphQL API, and integrations use the same API: an MIS pushing jobs, a web shop creating orders, a dashboard reading production status.

Endpoint ​

Each tenant has its own host. The API lives on that host:

text
POST https://<your-tenant-host>/graphql
Content-Type: application/json
Authorization: Bearer <API token>

The request body is standard GraphQL-over-HTTP JSON: query, and optionally variables and operationName.

The tenant is resolved from the host name, so you never pass a tenant ID in the query. A request whose host does not resolve to a tenant is rejected before any GraphQL runs.

The full schema is published as SDL at:

text
GET https://<your-tenant-host>/graphql/schema

Use it for code generation and editor tooling. The API reference on this site is generated from the same schema.

Authentication ​

Every request carries a bearer token in the Authorization header. There are two kinds of token, and both work the same way on the wire:

TokenWhere to create itUse it for
Service account tokenConsole: Service accounts. Create the account, attach the IAM policies it needs, open it and create a token in its API Tokens section.Integrations and anything long-running. The token represents the integration, not a person, and the account cannot sign in interactively.
Personal tokenConsole: user menu, API Tokens (/#/api-tokens)Local scripts and experiments. It carries your own permissions, so treat it like a password.

What a token may do is decided by the IAM policies attached to its account. If a token is missing or lacks a permission, the response carries a top-level GraphQL error (see Errors).

A first call to check that the host is reachable:

bash
curl -s https://<your-tenant-host>/graphql \
  -H "Authorization: Bearer $COCOCO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"query { ping }"}'
json
{ "data": { "ping": "pong" } }

ping needs no permissions, so it answers even with a bad token. To check the token, ask for something it must be allowed to read. With the job:list permission, this returns the number of jobs; without it, a top-level error:

bash
curl -s https://<your-tenant-host>/graphql \
  -H "Authorization: Bearer $COCOCO_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"query":"query { listJobs(first: 1) { totalCount } }"}'

Try queries in the console ​

Signed in to the console, you have two developer tools (the playground is shown to users whose permissions let them view scripts):

  • GraphQL playground at /#/graphql-playground: write and run queries and mutations against your tenant, with a schema explorer and a variables panel. It runs as your signed-in user, with your permissions.
  • API docs at /#/docs: guides and a schema reference.

Conventions ​

The same patterns apply across the whole schema. Core patterns covers each one with examples.

  • Types. Entities are named <Entity>State: JobState, ComponentState, OrderState.
  • Queries. get<Entity>(id:) fetches one record, get<Entity>By(externalId:) looks one up by your own reference, and list<Entities> returns a paginated connection.
  • Mutations. Most are named create<Entity>(input:), update<Entity>(id:, input:), upsert<Entity>(input:) and delete<Entity>, and return a payload with the entity and an errors list.
  • IDs. IDs are typed and prefixed, for example job_01M0R249JMETNBM1Z7466MXGZD.
  • Enums. Enum values are upper case on the wire (CONFIRMED, DIGITAL_PRINTING).

A typical first query, listing the five jobs due soonest:

graphql
query UpcomingJobs {
  listJobs(first: 5, sort: [{ field: DUE_AT, direction: ASC }]) {
    totalCount
    edges {
      node {
        id
        jobNumber
        name
        status
        dueAt
      }
    }
  }
}

Main domains ​

DomainMain typesStart with
ProductionJobState, JobGroupState, ComponentState, OperationState, MilestoneStateJob management, Components and media
CommerceCustomerState, EstimateState, OrderState, OrderLineState, InvoiceStateOrders and commerce
ShippingShipmentState, CarrierStateOrders and commerce
FilesFileState, ComponentArtworkFileStateComponents and media
Materials and purchasingSubstrateState, WarehouseStockState, WarehouseTransferState, SupplierState, PurchaseOrderStateAPI reference
Shop floorWorkCenterState, DeviceStateAPI reference
AutomationWorkflowStateWorkflow automation

Coming from JDF ​

If you know JDF, most concepts have a direct counterpart. The CoCoCo model is flat: records point at each other by ID instead of nesting inside one ticket.

JDFCoCoCo
Job ticket (root JDF node)JobState
Product part / component resourceComponentState, kind from ComponentKind
Media resourceComponentState.media (Media), or a substrate record (SubstrateState)
Layout / trim and bleed boxesComponentState.layout (ComponentLayout)
RunList / artwork filesComponentArtworkFileState linking a FileState to a component
Process nodeOperationState, kind from OperationKind
Node statusJobStatus, OperationStatus
DeviceDeviceState, grouped into a WorkCenterState
Customer infoCustomerState, ContactState, AddressState

Next steps ​

Connect machines, automate workflows, and build custom apps for print production.