Examples
Common patterns for building on MoveTheWheels. Install and authenticate the Node SDK before running these examples.
List vehicles and shipments
const vehicles = await sdk.movethewheels.vehicles.list(undefined, { limit: 10 });
const shipments = await sdk.movethewheels.shipments.list(undefined, { limit: 10 });
Query with GraphQL directly
import { GraphQLClient } from 'graphql-request';
const client = new GraphQLClient(
'https://graphqlworkspaces.burdenoff.com/workspaces/graphql',
{
headers: {
authorization: `Bearer ${process.env.MOVETHEWHEELS_API_KEY}`,
'x-workspace-id': process.env.WORKSPACE_ID!,
},
}
);
const data = await client.request(`
query {
shipments(pagination: { limit: 10 }) {
id
shipmentNumber
status
origin
destination
}
}
`);
Environment selection in code
const local = new MovethewheelsSDK({
workspaceEndpoint: 'http://localhost:4003/workspaces/graphql',
globalEndpoint: 'http://localhost:4000/global/graphql',
});