Piloterr

Mapping rules

How each row becomes the parameters of one call, and which rows a run skips before it starts.

  • A parameter maps to {"column": "…"} or {"value": "…"}. Parameters you leave out are not sent.

  • Every required parameter must be mapped, every column must be one of the input's, and every parameter one the endpoint takes. Dataflow checks the mapping against the endpoint and the input's columns when you create or update the project, and answers 422 mapping_invalid with the problems in error.details (Required parameter is not mapped, Column "…" is not in the input, Unknown parameter for this endpoint):

    {
      "error": {
        "code": "mapping_invalid",
        "message": "The mapping does not fit the endpoint or the input",
        "details": [{ "param": "domain", "message": "Column \"site\" is not in the input" }]
      }
    }
  • Values are trimmed. An empty value leaves the parameter out of that row's call, so an optional parameter stays unset.

  • A row that cannot be sent is not called and not billed: it gets the status invalid, with the reason in its error. That is a required parameter left empty (Missing required parameter: …), a value the parameter does not allow (when GET /v1/endpoints lists its enum: sort: Not one of asc, desc), or a value of another type for a number, integer or boolean parameter (limit: Not a number). Booleans read true, false, 1 or 0, in any case. A parameter with is_array takes a comma list and is not checked value by value.

  • Values are sent as text: in the query string for GET endpoints, in the JSON body for POST endpoints.

  • With a search input, the columns are the fields of the search results, plus search_query: the search that found the row. Map it like any other column, {"column": "search_query"}.

Check the rows before a run

POST /v1/inputs/{id}/check tells, before any run, which rows of an uploaded file or list a mapping would skip as invalid, and why. Runs follow the same rules, so the rows it counts are the ones a run skips. Nothing is stored and no credit is used. A URL or search input has no stored rows to check: it is read again at every run.

curl https://dataflow.piloterr.com/v1/inputs/INPUT_ID/check \
  -H "x-api-key: YOUR_API_KEY" -H "content-type: application/json" \
  -d '{"endpoint_id": "ENDPOINT_ID", "mapping": {"domain": {"column": "website"}}, "rate_percent": 50}'
{
  "total": 1200,
  "valid": 1185,
  "invalid": 15,
  "reasons": [
    { "code": "required_empty", "param": "domain", "message": "Missing required parameter", "count": 15, "rows": [4, 18, 77, 90, 132] }
  ],
  "estimate": { "rate_per_second": 5, "duration_seconds": 237 }
}
  • reasons come most frequent first; rows holds the first 5 row numbers, counted from 1. Codes: required_empty, not_allowed, not_a_number, not_an_integer, not_a_boolean. A row with two problems counts once in invalid and appears under both reasons.
  • estimate is the least a run over the valid rows takes at rate_percent (default 50) of your plan's rate limit: slow answers and the polls of asynchronous endpoints add to it. Both fields are null when the rate cannot be read.
  • A mapping that does not fit answers 422 mapping_invalid, as when creating a project; an endpoint you cannot run 422 endpoint_not_eligible; an unknown input 404 input_not_found.

The dashboard runs this check on the last step of a new project and shows the rows that will be skipped, the cost of the others and how long the run takes at least.

In the dashboard, a parameter is pre-mapped to the column with the same name, in any case, so naming your columns after the parameters saves a step.

On this page