AnsweredAssumed Answered

API Custom Fields

Question asked by thecomputerguy on Sep 6, 2017
Latest reply on Jan 16, 2018 by Scott Dennis

I need help. I'm confused how this API works with custom_fields and custom_field_values;

 

Currently I'm just trying to print out Manager First Name and Manager Last Name from a single user.

 

r = requests.get(url, headers=headers)

 

data = r.json()

#print(data)

custom_fields = {}

custom_field_values = {}

 

 

for custom in data['linked']['custom_fields']:

   print(custom.keys())

 

 

 

for values in data['linked']['custom_field_values']:

   print(values.keys())

 

 

 

for field in data['linked']['custom_fields']:

  custom_fields[field['id']] = field['name']

 

 

 

#print(values)
#print(custom)
print(custom_fields['47'] + " is:", values['value'], values['links'])

print(custom_fields['48'] + " is:", values['value'])

 

I'm doing this in Python to just run tests...my output is wrong...It keeps wanting to only pull the last name "Dillion" no matter what.

dict_keys(['id', 'name'])

dict_keys(['id', 'value', 'links'])

Manager First Name is: Dillon {'custom_field': {'id': '48', 'type': 'custom_fields'}}

Manager Last Name is: Dillon

Outcomes