Get movements
Returns all inventory movements available in MPower, including their origins, destination, status, and products.
GET/https://api-get-movements-kigtdz23uq-ew.a.run.app
Headers
x-api-key
<API_KEY>
string
Body Parameters
No body, query, or path parameters are required.
cURL
curl -i \
-H "x-api-key: <API_KEY>" \
https://api-get-movements-kigtdz23uq-ew.a.run.appResponse
200 Success
{
"count": 1,
"movements": {
"movementDocumentId": {
"name": "Movement name",
"status": "IN_PROGRESS",
"from": {
"originDocumentId": {
"id": "originDocumentId",
"name": "Origin name",
"type": "WAREHOUSE",
"products": {
"productDocumentId": {
"name": "Product name",
"sku": "AAA-000",
"units": 10
}
}
}
},
"to": {
"id": "destination-id",
"name": "Destination name",
"type": "WAREHOUSE"
}
}
}
}200 Success: no movements found
{
"count": 0,
"movements": {}
}401 Unauthorized
Returned when the x-api-key header is missing or invalid.
{
"error": "Unauthorized"
}403 Origin not allowed
Only applies to an OPTIONS preflight request sent from a browser origin that is not allowed by the CORS configuration.
{
"error": "Origin not allowed"
}405 Method not allowed
Returned when the endpoint is called with a method other than GET or OPTIONS. The response includes the header Allow: GET.
{
"error": "Method not allowed"
}500 API key is not configured
Returned when PRODUCT_PRICES_API_KEY is not available in the function runtime.
{
"error": "API key is not configured"
}Behavior / Side effects
Read-only endpoint
- Reads all documents from the movements collection.
- Does not create, update, or delete Firestore documents.
Request behavior
- Does not require body parameters.
- Does not support query parameters, filters, sorting, or pagination.
- Returns all movements in a single response.
Response shape
- Returns a top-level count and movements object.
- count contains the number of movements returned.
- count matches the number of keys inside movements.
- Each key inside movements is the Firestore movement document ID.
- Each movement includes name, status, from, and to.
- from is an object indexed by origin ID.
- A movement may contain one or more origins.
- Each origin contains id, name, type, and its own products object.
- Each key inside products is the product ID.
- to represents the movement destination and contains id, name, and type.
Field mapping
- movements.{movement_id}.name is read from movements/{movement_id}.name.
- movements.{movement_id}.status is read from movements/{movement_id}.status.
- from.{origin_id} is created from each entry inside movements/{movement_id}.from.
- from.{origin_id}.id is read from from.{origin_id}.id.
- from.{origin_id}.name is read from from.{origin_id}.name.
- from.{origin_id}.type is read from from.{origin_id}.type.
- from.{origin_id}.products.{product_id}.name is read from from.{origin_id}.products.{product_id}.name.en.
- from.{origin_id}.products.{product_id}.sku is read from from.{origin_id}.products.{product_id}.sku.
- from.{origin_id}.products.{product_id}.units is read from from.{origin_id}.products.{product_id}.units.
- to.id is read from to.id.
- to.name is read from to.name.
- to.type is read from to.type.
Status values
- The expected movement status values are IN_PROGRESS and COMPLETED.
- If the stored status is missing or has another value, the endpoint returns status: null.
Data quality expectations
- Movement names, origin data, destination data, product names, SKUs, and units are expected to exist in Firestore.
- Missing, empty, or invalid string values are returned as null.
- Missing or invalid numeric product units are returned as null.
- If from is missing or malformed, the endpoint returns from: {}.
- If an origin is malformed, its key is preserved and its fields are returned as null, with products: {}.
- If an origin has no valid products object, it returns products: {}.
- If to is missing or malformed, its id, name, and type fields are returned as null.
- Movements are not excluded because of missing or malformed fields.
- SKU values are returned as stored and are not validated or transformed.