$API_TOKEN=<YOUR_API_TOKEN>
$cat > input.json << 'EOF'
<{
< "tables": [
< {
< "name": "accounts",
< "csv": "id,name\r\n01,Ada\r\n01,Duplicate\r\n02,Lin\r\n",
< "primaryKey": [
< "id"
< ],
< "requiredColumns": [
< "name"
< ]
< },
< {
< "name": "orders",
< "csv": "id,account_id,note\n10,01,child of duplicate\n11,99,orphan\n12,02,\"accepted, link\"\n13,02,\"multi\nline\"\n",
< "primaryKey": [
< "id"
< ],
< "requiredColumns": [
< "note"
< ]
< },
< {
< "name": "items",
< "csv": "id,order_id,amount\n100,10,-12.5\n101,12,007\n102,11,3\n",
< "primaryKey": [
< "id"
< ],
< "requiredColumns": [
< "amount"
< ]
< }
< ],
< "foreignKeys": [
< {
< "table": "orders",
< "columns": [
< "account_id"
< ],
< "referencesTable": "accounts",
< "referencesColumns": [
< "id"
< ],
< "nullable": false
< },
< {
< "table": "items",
< "columns": [
< "order_id"
< ],
< "referencesTable": "orders",
< "referencesColumns": [
< "id"
< ],
< "nullable": false
< }
< ]
<}
<EOF
$curl "https://api.apify.com/v2/actors/bread-kim~csv-foreign-key-import-gate/runs?token=$API_TOKEN" \
< -X POST \
< -d @input.json \
< -H 'Content-Type: application/json'