Skip to content
TORNLIFE More

example curl command?

Started by shipto [2175892] on in API Development.

2 replies · 90 views · thread synced · 6 days ago · View on torn.com
About this thread

Posts archived: 3 / 3 posts (100%) · the total is Torn's reply count + the opening post at the last fetch

Counted by TornLife from the archived posts.

Archived posts
3
Discussion span
→
People posting
2
Likes on archived posts
2
Authority score
50 / 100
Historical score
16 / 100
Story score
24 / 100
Engagement score
41 / 100
shipto [2175892]

I've tried using curl to hit the API, but I either get errors like {"error":{"code":1,"error":"Key is empty"}}

even though I'm passing it as a parameter as shown in the "Try It" for the documentation.

or if I try to post it separately as the data, I get back the entire documentation page as if I'm visiting https://api.torn.com/user/

anyone had any luck that can provide an example?
Mauk [1494436]

This is how you'd call the API using curl:

curl -H 'user-agent: APP_NAME/VERSION' 'https://api.torn.com/user/?selections=basic&key=YOUR_API_KEY'

The user agent is not required but highly recommended. Use x-user-agent if calling from a browser or limited environment.