Skip to content
TORNLIFE More

Noob Question

Started by Wiber [2065939] on in API Development.

3 replies · 104 views · thread synced · 4 days ago · View on torn.com
About this thread

Posts archived: 4 / 4 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
4
Discussion span
→
People posting
3
Likes on archived posts
2
Posts by staff, officers and moderators
1
Authority score
71 / 100
Historical score
20 / 100
Story score
26 / 100
Engagement score
47 / 100

Most-liked replies

Wiber [2065939]

Back in 2019 I used to run API queries using JSON script embedded in a spreadsheet. I could get certain fields to download and ignore the rest. The API request for JSON looked like this - 

IMPORTJSON("https://api.torn.com/company/?selections=stock&key=MYAPIKEYHERE","/company_stock/Beer/sold_amount,/company_stock/Cider/sold_amount,/company_stock/Wine/sold_amount,/company_stock/Cocktail/sold_amount,/company_stock/Shot/sold_amount,/company_stock/Soft

These days I am using the API Connector function in Google Sheets and give it a request URL Like this

https://api.torn.com/v2/faction/members?striptags=true&key=MYAPIKEYHERE


How would I code the URL if I only wanted to download fields for members.id and members.name?


Apologies if you feel this should be in Q&A forum. 

DeKleineKobini [2114440] Committee Committee

Looked into what the API Connector is and what it does, and I figured it out. What you need is called JMESPath, which can be found in the advanced output section.

 

For your goal, the JMESPath you need is 'members[].{id:id,name:name}'