title: Unable to get linkedin API account and ads data
body: <p>I am unable to fetch data from linkedIn API; even though the response of the API is 200. I am not getting any data</p>
  <pre><code>import requests
  
   
  
  def  get_account_ids(accounts_req: list) -&gt; dict:
  
          
  
          access_token = &quot;&quot;
  
          headers = {'Connection': 'Keep-Alive',
  
                          'Authorization': 'Bearer {}'.format(access_token)}
  
          PATH = 'adAccountsV2'
  
          URI = 'https://api.linkedin.com/v2/' + PATH
  
          payload = {
  
              'q': 'search',
  
              'sort.field': 'ID',
  
              'sort.order': 'DESCENDING'
  
          }
  
   
  
          search_status_values = ['CANCELED', 'ACTIVE']
  
          for idx, val in enumerate(search_status_values):
  
              payload['search.status.values[{}]'.format(idx)] = str(val)
  
   
  
          search_type_values = ['BUSINESS', 'ENTERPRISE']
  
          for idx, val in enumerate(search_type_values):
  
              payload['search.type.values[{}]'.format(idx)] = str(val)
  
   
  
          r = requests.get(URI, params=payload,
  
                           headers=headers)
  
   
  
          acc_dict = {}
  
          for idx in range(0, len(r.json()['elements'])):
  
              acc_dict[r.json()['elements'][idx]['id']] = r.json()['elements'][idx]['name']
  
   
  
          for a in acc_dict.items():
  
               print(a.values)
  
          print(r)
  
          return {a_num: a_name for (a_num, a_name) in acc_dict.items() if a_num in accounts_req}
  
   
  
  def get_campaign_ids(accounts_req: list) -&gt; list:
  
          &quot;&quot;&quot;
  
          :param accounts_req:
  
          :return:
  
          &quot;&quot;&quot;
  
          access_token = &quot;&quot;
  
          headers = {'Connection': 'Keep-Alive',
  
                          'Authorization': 'Bearer {}'.format(access_token)}
  
          PATH = 'adCampaignsV2'
  
          URI = 'https://api.linkedin.com/v2/' + PATH
  
          payload = {
  
              'q': 'search',
  
              'sort.field': 'ID',
  
              'sort.order': 'DESCENDING'
  
          }
  
          linkedin_accs = get_account_ids(accounts_req)
  
          for idx, acc in enumerate(list(linkedin_accs)):
  
              payload['search.account.values[{}]'.format(
  
                  idx)] = 'urn:li:sponsoredAccount:{}'.format(acc)
  
   
  
          r = requests.get(URI, params=payload, headers=headers)
  
          json_obj = r.json()
  
          return [json_obj['elements'][i]['id'] for i in range(len(json_obj['elements']))]
  
   
  
  accounts_req = []
  
  account_details = get_account_ids(accounts_req)
  
  campaign_details = get_campaign_ids(account_details)
  
  print(account_details)
  
  print(campaign_details)
  </code></pre>
  <p>Output:</p>
  <pre><code>Response 200
  Response 200
  []
  []
  </code></pre>
  <p>Edit 1:</p>
  <p>Output of print(r.json())</p>
  <blockquote>
  <p>{'paging': {'start':0, 'count':1000, 'link':[]. 'total': 0},
  'elements':[]}</p>
  </blockquote>