Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: copy & paste friendly curl API example #1305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 10 additions & 12 deletions src/pages/api/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,20 +138,18 @@ export default function Api() {
<ClientCodeWrapper>
<CodeBlock title="cURL" language='bash'>
{`# Prepare Actor input
cat > input.json <<'EOF'
{
// Define the input in JSON here
}
EOF
echo '{ "searchStringsArray": ["Apify"] }' > input.json

# Run the Actor and retreive its default dataset id.
curl -X POST -d @input.json -H 'Content-Type: application/json' \\
-s -o >(tee run.json) \\
https://api.apify.com/v2/acts/compass~crawler-google-places/runs?token=<YOUR_API_TOKEN>

# Run the Actor
curl "https://api.apify.com/v2/acts/username~actorname/runs?token=<YOUR_API_TOKEN>" \\
-X POST \\
-d @input.json \\
-H 'Content-Type: application/json'
# Find the defaultDatasetId in the API response
cat run.json | jq -r .data.defaultDatasetId

# Use the defaultDatasetId from response and pass it instead of <DATASET_ID>
curl "https://api.apify.com/v2/datasets/<DATASET_ID>/items?token=<YOUR_API_TOKEN>"`
# And pass it instead of <DATASET_ID>
curl https://api.apify.com/v2/datasets/<DATASET>/items?token=<YOUR_API_TOKEN>`
}
</CodeBlock>
</ClientCodeWrapper>
Expand Down
Loading