PeaBox Lab › PeaLang › Learn › Chapter 17 › Lesson 4

Part III — Advanced Systems · Chapter 17 · Lesson 4 of 7 · 7 min read

Lesson 4: REST, GraphQL, OData, SFTP, Microsoft Graph, and SharePoint

Lesson level: Advanced

Purpose: Apply the connector contract to common enterprise protocols while recognizing their distinct security, query, pagination, and data-shape concerns.

Release note. The project materials describe REST and GraphQL connectors; OData standard query options, next-link pagination, count, metadata, and DataFrames; SFTP with host-key policy, password or key authentication, file operations, transfer, and CSV/JSON DataFrames through an optional dependency; and a Microsoft Graph/SharePoint foundation with later pagination hardening. Live provider certification remains a pending external gate.

Learning objectives

By the end of this lesson, you will be able to:

4.1 REST connectors

REST services expose resources through HTTP methods and paths. A REST connector must define allowed methods, path templates, query parameters, headers, request bodies, response schemas, status-code handling, and pagination.

Build paths from templates and encoded parameters. Do not concatenate untrusted path segments. Restrict methods to the operations required by the workflow: a reporting connector rarely needs delete authority.

Illustrative operation. GET /items with approved status and updated_since filters, bounded page size, bearer authentication from a secret reference, and an item schema containing id, SKU, quantity, location, and update time.

Common mistake. Assuming every successful response has the same envelope. Validate list, single-item, empty, and error-shaped responses separately.

4.2 GraphQL connectors

GraphQL clients request a selected shape from a schema, often through one endpoint. Selection is useful for data minimization, but the query document becomes part of the connector contract.

Store approved query documents in source control and supply variables separately. Do not accept arbitrary query text from users. Arbitrary queries can request excessive nesting, sensitive fields, or expensive resolvers.

GraphQL responses can contain both data and errors. A partial response is not automatically a success. Define whether the workflow accepts partial data, retries, or fails when the errors collection is nonempty.

Illustrative cursor contract. Query a products connection with first and after variables; select only id, SKU, name, price, and update time; read pageInfo for continuation; reject repeated end cursors; enforce page and record limits; treat any field-level error as failure unless an explicit partial policy approves it.

Common mistakes. Allowing unrestricted query documents; selecting entire nested objects; ignoring the errors array; and assuming that one endpoint means one authorization rule.

4.3 OData connectors

OData services expose entity sets and standard query options such as selection, filtering, ordering, top, skip, count, and metadata. The materials record support for standard query options, next-link pagination, count, metadata, and DataFrames.

Construct OData queries from validated components. Field names and functions must come from approved allowlists. Literal values must be encoded according to the service rules; never concatenate raw user text into a filter expression.

Metadata can support contract validation, but it is not a substitute for an approved schema. Use it to detect drift rather than to generate unrestricted queries.

A count can help reconcile completeness, but its semantics depend on the service and filter. Compare count with retrieved unique keys only when the service documents a consistent result for the traversal.

Guided practice. Design an OData request for active products updated after a supplied timestamp. Identify allowlisted fields, encoded values, page behavior, next-link validation, and count reconciliation.

Review prompt. Why does an OData filter require the same injection caution as SQL?

4.4 SFTP connectors

SFTP transfers files over an SSH connection. Its security depends on authenticating both sides: the client proves its identity, and the client verifies the server host key. Accepting an unknown host key silently defeats protection against server impersonation.

The materials describe secure host-key policy, password or key authentication, file operations, transfer, and CSV or JSON DataFrames through an optional dependency. Install and approve that dependency explicitly; do not assume it is present in every environment.

Restrict remote paths. Use an approved base directory and normalize relative paths before access. Reject path traversal, unexpected symbolic-link behavior, and writes outside the configured location.

Prefer atomic delivery patterns. A producer can upload to a temporary name and rename after completion. A consumer can process only completed files, verify size or checksum where available, and move or mark files after successful ingestion.

Illustrative inbound workflow. Verify the server key against the approved fingerprint; list files matching an approved pattern in the inbound directory; download each file to a controlled local workspace within size limits; validate checksum and schema; ingest valid files; move processed files to an archive path only after success.

Common mistakes. Disabling host-key checking; storing private keys in source; processing partially uploaded files; deleting remote files before durable ingestion; and allowing a remote filename to choose an arbitrary local path.

4.5 Microsoft Graph and SharePoint connectors

Microsoft Graph provides APIs for Microsoft 365 resources, including SharePoint sites, lists, drives, and files. Access depends on authentication, delegated or application permissions, tenant policy, and resource-specific authorization.

Request only the permissions required for the workflow. Reading one approved document library should not require broad tenant-wide write access. Permission design is part of the connector’s security contract and should be reviewed by the responsible administrator.

Graph responses commonly use pagination links. Follow continuation links only when they remain within the approved service boundary and stop at configured limits. The materials record later hardening of Graph and SharePoint pagination; still verify behavior against the target tenant and API version.

Illustrative library extract. Resolve an approved site and drive by configured identifiers; list files in one folder; select only name, identifier, size, and modified time; download approved file types within size limits; convert supported CSV or JSON content after validation.

Review prompt. Why is least-privilege permission design as important as secure token storage?

4.6 Protocol comparison and lab

Each protocol answers the same connector questions differently. REST centers on resource paths and methods. GraphQL centers on approved query documents and partial errors. OData centers on standardized query options and metadata. SFTP centers on host identity and file lifecycle. Graph and SharePoint center on tenant permissions and resource identifiers.

Common contract. Regardless of protocol, document authentication, authorization scope, allowed operations, request limits, retry policy, pagination or file traversal, response schema, error categories, data minimization, and certification evidence.

Hands-on lab. Prepare five fake-transport or local-test scenarios: a two-page REST extract; a GraphQL response with partial errors; an OData filter containing quote characters; an SFTP host-key mismatch using a test double; and a Graph continuation link to an unapproved host. Each must fail or succeed according to its contract without live credentials.

Then write a live-validation plan for one approved non-production service. Include owner approval, test tenant or endpoint, service account, minimum permissions, synthetic data, cleanup, rollback, and evidence retention. Do not execute live tests without authorization.

Review questions. Why should GraphQL query documents be approved? How should OData literals be encoded? What does SFTP host-key verification prevent? Why are Graph permissions part of the contract? Which protocol behaviors need live certification?

Applied challenge. Create a connector comparison matrix for an organization choosing between an OData feed and a GraphQL API for the same product data. Compare minimization, pagination, schema drift, performance evidence, permissions, and operational ownership.

Lesson summary. Protocol choice changes the details, not the discipline. Approve operations, minimize data and permissions, validate continuation and file boundaries, classify errors, and keep fake-test evidence separate from live certification.

Common mistakes

Review questions

Applied challenge

Design an integration that reads documents from a SharePoint library, enriches them from a REST service, and drops a summary file on an SFTP server. For each connector, list its authentication method, scopes, pagination model, retry policy, and the tests that would be needed for certification.

Lesson summary

Each protocol has its own query, paging, and error conventions, but all connectors share one contract. Choose the protocol that fits the source, request minimal permissions, handle protocol-specific errors, and treat live provider integrations as uncertified until your own tests prove them.

Lesson status: Ready for review.

← Previous Next →