Links

Upload Demand Data

Upload your demand data as CSV, line-delimited JSON or JSON.

Request

HTTP Request

POST https://api.predicthq.com/v1/beam/analyses/$analysis_id/sink

Path Parameters

Parameter
Description
analysis_id
An existing Beam Analysis ID.

Request Headers

Header
Value
Content-Type
Must be one of the following:
  • text/csv
  • application/x-ldjson
  • application/json

Request Body

You can upload the demand data for your analysis in any of the following formats:
CSV
Line-delimited JSON
JSON
The request body should contain comma separated values representing multiple data points with the columns named date and demand as in the following example:
date,demand
2023-01-01,12.235
2023-01-02,11.4
2023-01-03,12.14
The following request headers must be set:
Header
Value
Content-Type
text/csv
The request body should contain a list JSON objects representing multiple data points, one data point per line using the following format:
{"date": "2023-01-01", "demand": 12.235}
{"date": "2023-01-02", "demand": 11.4}
{"date": "2023-01-03", "demand": 12.14}
The following request headers must be set:
Header
Value
Content-Type
application/x-ldjson
The request body should contain a JSON object representing a single data point, only a single data point can be uploaded per request using the following example:
{
"date": "2023-01-01",
"demand": 12.235
}
The following request headers must be set:
Header
Value
Content-Type
application/json

Response

If successful, the HTTP response code will be 202 Accepted.

Examples

curl
python
curl -X POST https://api.predicthq.com/v1/beam/analyses/$ANALYSIS_ID/sink \
-H "Content-Type: text/csv" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @data.csv
import requests
response = requests.post(
url="https://api.predicthq.com/v1/beam/analyses/$ANALYSIS_ID/sink",
headers={
"Authorization": "Bearer $ACCESS_TOKEN",
"Content-Type": "text/csv"
},
data=open("data.csv")
)
print(response.json())

Guides

Below are some guides relevant to this API: