- You will need to initialize your own struct (GraphAPIResponse) for the reponse based on what you're expecting to get back.
- Use Graph API explorer (https://developers.facebook.com/tools/explorer/) to test Graph API to see what you need to retrieve, in my case it was accounts (/me/adaccounts?limit=500&fields=id,name)
- Click on
</> Get Code
and select cURL - Run cURL command in the terminal
- Assuming data came back, copy everything starting with
{"data"
and ending with}}}
- Paste it into https://mholt.github.io/json-to-go/ to get the struct
The code will work for campaigns and adsets already, assuming you only need campaign/adset IDs and names. For other calls you will need to generate your own logic based on the samples above.