$API_TOKEN=<YOUR_API_TOKEN>
$cat > input.json << 'EOF'
<{
< "mappings": [
< {
< "id": "001",
< "sourceUrl": "https://example.com/Old?campaign=Q3#section",
< "expectedFinalUrl": "https://example.com/New/?campaign=Q3"
< },
< {
< "id": "002",
< "sourceUrl": "https://example.com/legacy",
< "expectedFinalUrl": "https://example.com/current"
< },
< {
< "id": "003",
< "sourceUrl": "https://example.com/sale-old",
< "expectedFinalUrl": "https://example.com/sale-new"
< },
< {
< "id": "004",
< "sourceUrl": "https://example.com/retired",
< "expectedFinalUrl": "https://example.com/retired",
< "expectedFinalStatus": 410
< },
< {
< "id": "005",
< "sourceUrl": "https://example.com/loop-a",
< "expectedFinalUrl": "https://example.com/loop-final"
< },
< {
< "id": "006",
< "sourceUrl": "https://example.com/unreachable",
< "expectedFinalUrl": "https://example.com/available"
< },
< {
< "id": "007",
< "sourceUrl": "https://example.com/missing",
< "expectedFinalUrl": "https://example.com/missing"
< }
< ],
< "traces": [
< {
< "mappingId": "001",
< "steps": [
< {
< "url": "https://example.com/Old?campaign=Q3",
< "status": 301,
< "location": "/New/?campaign=Q3"
< },
< {
< "url": "https://example.com/New/?campaign=Q3",
< "status": 200
< }
< ]
< },
< {
< "mappingId": "002",
< "steps": [
< {
< "url": "https://example.com/legacy",
< "status": 308,
< "location": "/current"
< },
< {
< "url": "https://example.com/current",
< "status": 200
< }
< ]
< },
< {
< "mappingId": "003",
< "steps": [
< {
< "url": "https://example.com/sale-old",
< "status": 302,
< "location": "/home"
< },
< {
< "url": "https://example.com/home",
< "status": 200
< }
< ]
< },
< {
< "mappingId": "004",
< "steps": [
< {
< "url": "https://example.com/retired",
< "status": 410
< }
< ]
< },
< {
< "mappingId": "005",
< "steps": [
< {
< "url": "https://example.com/loop-a",
< "status": 301,
< "location": "/loop-b"
< },
< {
< "url": "https://example.com/loop-b",
< "status": 301,
< "location": "/loop-a"
< }
< ]
< },
< {
< "mappingId": "006",
< "steps": [],
< "failure": "transport_error"
< },
< {
< "mappingId": "007",
< "steps": [
< {
< "url": "https://example.com/missing",
< "status": 404
< }
< ]
< }
< ]
<}
<EOF
$curl "https://api.apify.com/v2/actors/h_murdock~redirect-release-qa/runs?token=$API_TOKEN" \
< -X POST \
< -d @input.json \
< -H 'Content-Type: application/json'