# Requests, pagination and dates

## Request format

- JSON request bodies with `Content-Type: application/json`.
- Path parameters are case-sensitive; partner codes are upper-case as issued.
- Field names in request bodies are PascalCase, matching the platform (`TripNotes`, `FreightDetails`, `TractorStatus`).

## Pagination

Four paging styles exist, depending on where the data is served from.

### Search-index lists

`Get Orders`, `Get Loads`, `Get Tractors`, `Get Drivers`, `Get Carriers`

- `page` query parameter, 1-based; omit for page 1.
- 100 records per page, newest activity first.
- The response is a **bare JSON array**. No total count or page size is returned; keep requesting the next page until you receive a `404` with a text body such as `No orders found.`
- A `page` that is not a positive integer answers `400` with the text `Page parameter must be a positive integer`.

`Get Orders` also accepts `refNumber`, `orderNumber`, `status`, `billTo` and `sort` (`DateLastActivity` or `CreatedAt`). `Get Loads` accepts `refNumber`.

### Envelope lists

`Get Locations`

```json
{ "status": "ok", "page": 1, "pageSize": 100, "totalCount": 240, "locations": [ ... ] }
```

Use `totalCount` and `pageSize` to compute the last page.

### Activity cursor

`Get Recently Updated Cards` (`GET .../cards/recentlyupdated/{cardtype}`)

- Required `dateLastActivity` (ISO 8601). Cards with activity after that instant are returned, oldest first. Keep this value the same on every page.
- Optional `searchAfter`: the `paginationToken` from the last card of the previous page. Omit it for the first page.
- Optional `limit` (default 500, maximum 500) and `fields` (default `_id`). `paginationToken` is included either way.
- The response is `{ "cards": [ ... ] }`. An empty page, including a partner with no boards, is `200` with `{ "cards": [] }`.

### Position queries

`Get GPS Positions` on orders and tractors return at most 100 positions, newest first, inside `{ "positions": [...], "moreAvailable": true|false }`. Narrow the window with `startdate` (tractors) rather than paging through history.

## Dates and times

- Timestamps are ISO 8601 in UTC with a `Z` suffix: `2026-10-01T13:42:10.000Z`.
- `startdate` and `starttime` query parameters take the same form.
- `Get Hours of Service` takes a calendar date in the path: `/drivers/hos/2026-10-01`.
- Positions include `TimeZoneOffset` as `±HH:MM` for the fix.

## Response content types

| Situation | Content type |
|---|---|
| Success with a body | `application/json` |
| Success without a body (`204`, offer accept/reject) | none |
| Empty list on search-index routes, unknown partner, partnership denied, bad page | `text/plain` |
| Empty recently-updated page | `application/json` `{ "cards": [] }` |
| Gateway authentication problems | `application/json` problem details |
| Partnership request | `text/plain` |

Handle `text/plain` on every non-2xx; do not assume JSON.

## Idempotency and retries

- Reads are safe to retry.
- `Accept an Offer` and `Reject an Offer` are HTTP `GET` but change state. A second call answers `404 Load already accepted or rejected`.
- Writes are not idempotent by key. Retry only after a network failure where no response was received, and prefer checking the record first.
