{%- if api == "/api/circuits/circuit-terminations/" %}
ID,Description,Display,Occupied,Cable ID,Cable Display,Cable Label,Cable URL,CID,Circuit Display,Circuit ID,URL,Created,Last Updated,Link Peer Occupied,Link Peer Cable,Link Peer ID,Link Peer Name,Link Peer Display,Link Peer URL,Link Peer Type,Mark Connected,Port Speed,PP Info,Provider Network ID,Provider Network Name,Provider Network Display,Provider Network URL,Site ID,Site Name,Site Display,Site Slug,Site URL,Term Side,Upstream Speed,URL,XConnect ID
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['description'] }},{{ result['display'] }},{{ result['_occupied'] }},{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{{ result['circuit']['cid'] }},{{ result['circuit']['display'] }},{{ result['circuit']['id'] }},{{ result['circuit']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{%- if result['link_peer'] %}{{ result['link_peer']['_occupied'] | default("False") }},{{ result['link_peer']['cable'] }},{% if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{% else %}N/A,N/A,N/A,N/A,{% endif %}{%- else %}N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mark_connected'] }},{{ result['port_speed'] }},{{ result['pp_info'] }},{{ result['provider_network']['id'] }},{{ result['provider_network']['name'] }},{{ result['provider_network']['display'] }},{{ result['provider_network']['url'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['term_side'] }},{{ result['upstream_speed'] }},{{ result['url'] }},{{ result['xconnect_id'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/circuits/circuit-types/" %}
ID,Name,Display,Description,Slug,Circuit Count,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['name'] }},{{ result['display'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['circuit_count'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/circuits/circuits/" %}
ID,CID,Display,Description,Comments,Commit Rate,Status Label,Status Value,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Type ID,Type Name,Type Display,Type Slug,Type URL,Provider ID,Provider Name,Provider Display,Provider Slug,Provider URL,Termination A ID,Termination A Display,Termination A Port Speed,Termination A Site ID,Termination A Site Name,Termination A Site Display,Termination A Site Slug,Termination A Site URL,Termination A Upstream Speed,Termination A Provider Network ID,Termination A Provider Network Name,Termination A Provider Network Display,Termination A Provider Network URL,Termination A URL,Termination A XConnect ID,Termination Z ID,Termination Z Display,Termination Z Port Speed,Termination Z Site ID,Termination Z Site Name,Termination Z Site Display,Termination Z Site Slug,Termination Z Site URL,Termination Z Upstream Speed,Termination Z Provider Network ID,Termination Z Provider Network Name,Termination Z Provider Network Display,Termination Z Provider Network URL,Termination Z URL,Termination Z XConnect ID,Created,Last Updated,Install Date,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['cid'] }},{{ result['display'] }},{{ result['description'] }},{{ result['comments'] }},{{ result['commit_rate'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ")}},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['type']['id'] }},{{ result['type']['name'] }},{{ result['type']['display'] }},{{ result['type']['slug'] }},{{ result['type']['url'] }},{{ result['provider']['id'] }},{{ result['provider']['name'] }},{{ result['provider']['display'] }},{{ result['provider']['slug'] }},{{ result['provider']['url'] }},{{ result['termination_a']['id'] }},{%- if result['termination_a']%}{{ result['termination_a']['display'] }},{{ result['termination_a']['port_speed'] }},{%     if result['termination_a']['site'] is defined %}{{ result['termination_a']['site']['id'] }},{{ result['termination_a']['site']['name'] }},{{ result['termination_a']['site']['display'] }},{{ result['termination_a']['site']['slug'] }},{{ result['termination_a']['site']['url'] }},{%     else %}N/A,N/A,N/A,N/A,N/A,{%     endif %}{{ result['termination_a']['upstream_speed'] }},{%     if result['termination_a']['provider_network'] is defined %}{{ result['termination_a']['provider_network']['id'] }},{{ result['termination_a']['provider_network']['name'] }},{{ result['termination_a']['provider_network']['display'] }},{{ result['termination_a']['provider_network']['url'] }},{%     else %}N/A,N/A,N/A,N/A,{%     endif %}{{ result['termination_a']['url'] }},{{ result['termination_a']['xconnect_id'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['termination_z']['id'] }},{{ result['termination_z']['display'] }},{{ result['termination_z']['port_speed'] }},{% if result['termination_z']['site'] is defined %}{{ result['termination_z']['site']['id'] }},{{ result['termination_z']['site']['name'] }},{{ result['termination_z']['site']['display'] }},{{ result['termination_z']['site']['slug'] }},{{ result['termination_z']['site']['url'] }},{% else %}N/A,N/A,N/A,N/A,{% endif %}{{ result['termination_z']['upstream_speed'] }},{% if result['termination_z']['provider_network'] is defined %}{{ result['termination_z']['provider_network']['id'] }},{{ result['termination_z']['provider_network']['name'] }},{{ result['termination_z']['provider_network']['display'] }},{{ result['termination_z']['provider_network']['url'] }},{% else %}N/A,N/A,N/A,N/A,{% endif %}{{ result['termination_z']['url'] }},{{ result['termination_z']['xconnect_id'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['install_date'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/circuits/provider-networks/" %}
ID,Name,Display,Description,Comments,Service ID,Provider ID,Provider Name,Provider Display,Provider Slug,Provider URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['name'] }},{{ result['display'] }},{{ result['description'] }},{{ result['comments'] }},{{ result['service_id'] }},{{ result['provider']['id'] }},{{ result['provider']['name'] }},{{ result['provider']['display'] }},{{ result['provider']['slug'] }},{{ result['provider']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/circuits/providers/" %}
ID,Name,Display,Account,Admin Contact,NOC Contact,ASN,Circuit Count,Comments,Slug,Created,Last Updated,Portal URL,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['name'] }},{{ result['display'] }},{{ result['account'] }},{{ result['admin_contact'] }},{{ result['noc_contact'] }},{{ result['asn'] }},{{ result['circuit_count'] }},{{ result['comments'] }},{{ result['slug'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['portal_url'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/cables/" %}
ID,Display,Label,Type,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Color,Length,Length Unit,Status Label,Status Value,Termination A ID,Termination A Type,Termination A Display,Termination A Cable,Termination A Occupied,Termination A Term Side,Termination A Circuit ID,Termination A Circuit CID,Termination A Circuit Display,Termination A Circuit URL,Termination A URL,Termination B ID,Termination B Type,Termination B Display,Termination B Cable,Termination B Occupied,Termination B Term Side,Termination B Circuit ID,Termination B Circuit CID,Termination B Circuit Display,Termination B Circuit URL,Termination B URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['label'] }},{{ result['type'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ")}},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['color'] }},{{ result['length'] }},{{ result['length_unit'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['termination_a_id'] }},{{ result['termination_a_type'] }},{%- if result['termination_a'] %}{{ result['termination_a']['display'] }},{{ result['termination_a']['cable'] }},{{ result['termination_a']['_occupied'] }},{{ result['termination_a']['term_side'] }},{% if result['termination_a']['circuit'] is defined %}{{ result['termination_a']['circuit']['id'] }},{{ result['termination_a']['circuit']['cid'] }},{{ result['termination_a']['circuit']['display'] }},{{ result['termination_a']['circuit']['url'] }},{% else %}N/A,N/A,N/A,N/A,{% endif %}{{ result['termination_a']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['termination_b_id'] }},{{ result['termination_b_type'] }},{%- if result['termination_b'] %}{{ result['termination_b']['display'] }},{{ result['termination_b']['cable'] }},{{ result['termination_b']['_occupied'] }},{{ result['termination_b']['term_side'] }},{% if result['termination_b']['circuit'] is defined %}{{ result['termination_b']['circuit']['id'] }},{{ result['termination_b']['circuit']['cid'] }},{{ result['termination_b']['circuit']['display'] }},{{ result['termination_b']['circuit']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{% endif %}{{ result['termination_b']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/console-port-templates/" %}
ID,Display,Name,Description,Label,Module Type ID,Module Type Display,Module Type Model,Module Type Manufacturer ID,Module Type Manufacturer Name,Module Type Manufacturer Display,Module Type Manufacturer Slug,Module Type Manufacturer URL,Module Type URL,Type Label,Type Value,Device Type ID,Device Type Display,Device Type Model,Device Type Slug,Device Type URL,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['module_type']['id'] }},{{ result['module_type']['display'] }},{{ result['module_type']['model'] }},{%- if result['module_type']['manufacturer'] is defined %}{{ result['module_type']['manufacturer']['id'] }},{{ result['module_type']['manufacturer']['name'] }},{{ result['module_type']['manufacturer']['display'] }},{{ result['module_type']['manufacturer']['slug'] }},{{ result['module_type']['manufacturer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['module_type']['url'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['model'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['url'] }},{%- if result['device_type']['manufacturer'] is defined %}{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/console-ports/" %}
ID,Display,Name,Description,Label,Occupied,Device ID,Device Name,Device Display,Device URL,Cable ID,Cable Display,Cable Label,Cable URL,Connected Endpoint,Connected Endpoint Reachable,Connected Endpoint Type,Link Peer ID,Link Peer Name,Link Peer Display,Link Peer Cable,Link Peer Occupied,Link Peer Device ID,Link Peer Device Name,Link Peer Device Display,Link Peer Device URL,Link Peer URL,Link Peer Type,Mark Connected,Module ID,Module Display,Module Device,Module Bay ID,Module Bay Name,Module Bay Display,Module Bay URL,Module URL,Speed,Type Label,Type Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['_occupied'] }},{%- if result['device'] is defined %}{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{{ result['connected_endpoint'] }},{{ result['connected_endpoint_reachable'] }},{{ result['connected_endpoint_type'] }},{%- if result['link_peer'] %}{{ result['link_peer']['id'] }},{{ result['link_peer']['name'] }},{{ result['link_peer']['display'] }},{{ result['link_peer']['cable'] }},{{ result['link_peer']['_occupied'] }},{%- if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mark_connected'] }},{{ result['module']['id'] }},{{ result['module']['display'] }},{{ result['module']['device'] }},{% if result['module']['module_bay'] is defined %}{{ result['module']['module_bay']['id'] }},{{ result['module']['module_bay']['name'] }},{{ result['module']['module_bay']['display'] }},{{ result['module']['module_bay']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['module']['url'] }},{{ result['speed'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['created'] }},{{ result['last_updated']}},{{ result['url'] }}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['_occupied'] }},{%- if result['device'] is defined %}{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{{ result['connected_endpoint'] }},{{ result['connected_endpoint_reachable'] }},{{ result['connected_endpoint_type'] }},{%- if result['link_peer'] %}{{ result['link_peer']['id'] }},{{ result['link_peer']['name'] }},{{ result['link_peer']['display'] }},{{ result['link_peer']['cable'] }},{{ result['link_peer']['_occupied'] }},{%- if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mark_connected'] }},{{ result['module']['id'] }},{{ result['module']['display'] }},{{ result['module']['device'] }},{% if result['module']['module_bay'] is defined %}{{ result['module']['module_bay']['id'] }},{{ result['module']['module_bay']['name'] }},{{ result['module']['module_bay']['display'] }},{{ result['module']['module_bay']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['module']['url'] }},{{ result['speed'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['created'] }},{{ result['last_updated']}},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/device-bay-templates/" %}
ID,Display,Name,Description,Label,Device Type ID,Device Type Display,Device Type Slug,Device Type Model,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Device Type URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['model'] }},{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{{ result['device_type']['url'] }},{{ result['created']}},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/device-bays/" %}
ID,Display,Name,Description,Label,Device ID,Device Display,Device Name,Device URL,Installed Device,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['device']['id'] }},{{ result['device']['display'] }},{{ result['device']['name'] }},{{ result['device']['url'] }},{{ result['installed_device'] }},{{ result['created']}},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/device-roles/" %}
ID,Display,Name,Description,Slug,Device Count,Virtual Machine Count,VM Role,Color,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['device_count'] }},{{ result['virtualmachine_count'] }},{{ result['vm_role'] }},{{ result['color'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/device-types/" %}
ID,Display,Slug,Comments,Model,Part Number,Device Count,Subdevice Role Label,Subdevice Role Value,Manufacturer ID,Manufacturer Name, Manufacturer Display,Manufacturer Slug,Manufacturer URL,Rack Unit Height,Full Depth,Front Image,Rear Image,Airflow,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['slug'] }},{{ result['comments'] }},{{ result['model'] }},{{ result['part_number'] }},{{ result['device_count'] }},{{ result['subdevice_role']['label'] }},{{ result['subdevice_role']['value'] }},{{ result['manufacturer']['id'] }},{{ result['manufacturer']['name'] }},{{ result['manufacturer']['display'] }},{{ result['manufacturer']['slug'] }},{{ result['manufacturer']['url'] }},{{ result['u_height'] }},{{ result['is_full_depth'] }},{{ result['front_image']}},{{ result['rear_image']}},{{ result['airflow']}},{{ result['created']}},{{ result['last_updated']}},{{ result['url']}}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/devices/" %}
ID,Display,Name,Comments,Asset Tag,Serial Number,Location ID,Location Name,Location Display,Location Slug,Location Depth,Location URL,Platform ID,Platform Name,Platform Display,Platform Slug,Platform URL,Parent Device,Cluster,Position,Airflow,Device Role ID,Device Role Name,Device Role Display,Device Role Slug,Device Role URL,Device Type ID,Device Type Display,Device Type Slug,Device Type Model,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Device Type URL,Face Label,Face Value,Rack ID,Rack Name,Rack Display,Rack URL,Site ID,Site Name,Site Display,Site Slug,Site URL,Status Label,Status Value,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Primary IP,Primary IPv4,Primary IPv6,VC Position,VC Priority,Virtual Chassis,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['comments'] }},{{ result['asset_tag'] }},{{ result['serial'] }},{{ result['location']['id'] }},{{ result['location']['name'] }},{{ result['location']['display'] }},{{ result['location']['slug'] }},{{ result['location']['_depth'] }},{{ result['location']['url'] }},{{ result['platform']['id'] }},{{ result['platform']['name'] }},{{ result['platform']['display'] }},{{ result['platform']['slug'] }},{{ result['platform']['url'] }},{{ result['parent_device'] }},{{ result['cluster'] }},{{ result['position'] }},{{ result['airflow'] }},{{ result['device_role']['id'] }},{{ result['device_role']['name'] }},{{ result['device_role']['display'] }},{{ result['device_role']['slug'] }},{{ result['device_role']['url'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['model'] }},{%- if result['device_type']['manufacturer'] is defined %}{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{% endif %}{{ result['device_type']['url'] }},{{ result['face']['label'] }},{{ result['face']['value'] }},{{ result['rack']['id'] }},{{ result['rack']['name'] }},{{ result['rack']['display'] }},{{ result['rack']['url'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['primary_ip']['display'] }},{{ result['primary_ip4']['display'] }},{{ result['primary_ip6']['display'] }},{{ result['vc_position'] }},{{ result['vc_priority'] }},{{ result['virtual_chassis'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/front-port-templates/" %}
ID,Display,Name,Label,Module Type,Color,Device Type ID,Device Type Display,Device Type Slug,Device Type Model,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Device Type URL,Type Label,Type Value,Rear Port ID,Rear Port Name,Rear Port Display,Rear Port URL,Rear Port Position,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['label'] }},{{ result['module_type'] }},{{ result['color'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['model'] }},{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{{ result['device_type']['url'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['rear_port']['id'] }},{{ result['rear_port']['name'] }},{{ result['rear_port']['display'] }},{{ result['rear_port']['url'] }},{{ result['rear_port_position'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/front-ports/" %}
ID,Display,Name,Label,Description,Occupied,Cable ID,Cable Display,Cable Label,Cable URL,Color,Device ID,Device Name,Device Display,Device URL,Link Peer ID,Link Peer Name,Link Peer Display,Link Peer Cable,Link Peer Occupied,Link Peer Device ID,Link Peer Device Name,Link Peer Device Display,Link Peer Device URL,Link Peer URL,Link Peer Type,Mark Connected,Module,Rear Port ID,Rear Port Name,Rear Port Display,Rear Port Label,Rear Port URL,Rear Port Position,Type Label,Type Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['label'] }},{{ result['description'] }},{{ result['_occupied'] }},{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{{ result['color'] }},{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{%- if result['link_peer'] %}{{ result['link_peer']['id'] }},{{ result['link_peer']['name'] }},{{ result['link_peer']['display'] }},{{ result['link_peer']['cable'] }},{{ result['link_peer']['_occupied'] }},{%- if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mark_connected'] }},{{ result['module'] }},{{ result['rear_port']['id'] }},{{ result['rear_port']['name'] }},{{ result['rear_port']['display'] }},{{ result['rear_port']['label'] }},{{ result['rear_port']['url'] }},{{ result['rear_port_position'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/interface-templates/" %}
ID,Display,Name,Label,Description,Management Only,Module Type ID,Module Type Display,Module Type Model,Module Type URL,Module Type Manufacturer ID,Module Type Manufacturer Name,Module Type Manufacturer Display,Module Type Manufacturer Slug,Module Type Manufacturer URL,Type Label,Type Value,Device Type ID,Device Type Display,Device Type Model,Device Type Slug,Device Type URL,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['label'] }},{{ result['description'] }},{{ result['mgmt_only'] }},{{ result['module_type']['id'] }},{{ result['module_type']['display'] }},{{ result['module_type']['model'] }},{{ result['module_type']['url'] }},{%- if result['module_type']['manufacturer'] is defined %}{{ result['module_type']['manufacturer']['id'] }},{{ result['module_type']['manufacturer']['name'] }},{{ result['module_type']['manufacturer']['display'] }},{{ result['module_type']['manufacturer']['slug'] }},{{ result['module_type']['manufacturer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['model'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['url'] }},{%- if result['device_type']['manufacturer'] is defined %}{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/interfaces/" %}
ID,Display,Name,Label,Description,Management Only,Module ID,Module Display,Module Device,Module Slot,Module URL,Module Bay ID,Module Bay Name,Module Bay Display,Module Bay URL,Type Label,Type Value,Device Type ID,Device Name,Device Display,Device URL,Occupied,Bridge,Cable ID,Cable Display,Cable Label,Cable URL,Connected Endpoint ID,Connected Endpoint Name,Connected Endpoint Display,Connected Endpoint Occupied,Connected Endpoint Cable,Connected Endpoint URL,Connected Endpoint Device ID,Connected Endpoint Device Name,Connected Endpoint Device Display,Connected Endpoint Device URL,Connected Endpoint Reachable,Connected Endpoint Type,FHRP Groups Count,IP Address Count,Duplex,Enabled,Lag ID,Lag Name,Lag Display,Lag Occupied,Lag Cable,Lag URL,Lag Device ID,Lag Device Name,Lag Device Display,Lag Device URL,Link Peer ID,Link Peer Name,Link Peer Display,Link Peer Occupied,Link Peer Cable,Link Peer URL,Link Peer Device ID,Link Peer Device Name,Link Peer Device Display,Link Peer Device URL,Link Peer Type,MAC Address,Mark Connected,Mode,MTU,RF Channel,RF Channel Frequency,RF Channel Width,RF Role,Speed,Tagged VLANs,Untagged VLAN,TX Power,VRF,Wirless LANs,Wireless Link,WWN,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['label'] }},{{ result['description'] }},{{ result['mgmt_only'] }},{{ result['module']['id'] }},{{ result['module']['display'] }},{{ result['module']['device'] }},{{ result['module']['slot'] }},{{ result['module']['url'] }},{%- if result['module']['module_bay'] is defined %}{{ result['module']['module_bay']['id'] }},{{ result['module']['module_bay']['name'] }},{{ result['module']['module_bay']['display'] }},{{ result['module']['module_bay']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{% endif %}{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{{ result['_occupied'] }},{{ result['bridge'] }},{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{%- if result['connected_endpoint'] %}{{ result['connected_endpoint']['id'] }},{{ result['connected_endpoint']['name'] }},{{ result['connected_endpoint']['display'] }},{{ result['connected_endpoint']['_occupied'] }},{{ result['connected_endpoint']['cable'] }},{{ result['connected_endpoint']['url'] }},{%- if result['connected_endpoint']['device'] is defined %}{{ result['connected_endpoint']['device']['id'] }},{{ result['connected_endpoint']['device']['name'] }},{{ result['connected_endpoint']['device']['display'] }},{{ result['connected_endpoint']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['connected_endpoint_reachable'] }},{{ result['connected_endpoint_type'] }},{{ result['count_fhrp_groups'] }},{{ result['count_ipaddresses'] }},{{ result['duplex'] }},{{ result['enabled'] }},{{ result['lag']['id'] }},{{ result['lag']['name'] }},{{ result['lag']['display'] }},{{ result['lag']['_occupied'] }},{{ result['lag']['cable'] }},{{ result['lag']['url'] }},{%- if result['lag']['device'] is defined %}{{ result['lag']['device']['id'] }},{{ result['lag']['device']['name'] }},{{ result['lag']['device']['display'] }},{{ result['lag']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{%- if result['link_peer'] %}{{ result['link_peer']['id'] }},{{ result['link_peer']['name'] }},{{ result['link_peer']['display'] }},{{ result['link_peer']['_occupied'] }},{{ result['link_peer']['cable'] }},{{ result['link_peer']['url'] }},{%- if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mac_address'] }},{{ result['mark_connected'] }},{{ result['mode'] }},{{ result['mtu'] }},{{ result['rf_channel'] }},{{ result['rf_channel_frequency'] }},{{ result['rf_channel_width'] }},{{ result['rf_role'] }},{{ result['speed'] }},{{ result['tagged_vlans'] | replace(","," ") }},{{ result['untagged_vlan'] }},{{ result['tx_power'] }},{{ result['vrf'] }},{{ result['wireless_lans'] | replace(","," ") }},{{ result['wireless_link'] }},{{ result['wwn'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/inventory-items/" %}
ID,Display,Name,Label,Description,Asset Tag,Component ID,Component Type,Component Name,Component Display,Component Occupied,Component Cable,Component URL,Component Device ID,Component Device Name,Component Device Display,Component Device URL,Device ID,Device Name,Device Display,Device URL,Discovered,Manufacturer,Part ID,Role,Serial Number,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['label'] }},{{ result['description'] }},{{ result['asset_tag'] }},{{ result['component_id'] }},{{ result['component_type'] }},{{ result['component']['name'] }},{{ result['component']['display'] }},{{ result['component']['_occupied'] }},{{ result['component']['cable'] }},{{ result['component']['url'] }},{%- if result['component']['device'] %}{{ result['component']['device']['id'] }},{{ result['component']['device']['name'] }},{{ result['component']['device']['display'] }},{{ result['component']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{{ result['discovered'] }},{{ result['manufacturer'] }},{{ result['part_id'] }},{{ result['role'] }},{{ result['serial'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/locations/" %}
ID,Display,Name,Description,Slug,Depth,Device Count,Rack Count,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Site ID,Site Name,Site Display,Site Slug,Site URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['_depth'] }},{{ result['device_count'] }},{{ result['rack_count'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ")}},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/manufacturers/" %}
ID,Display,Name,Description,Slug,Device Type Count,Inventory Type Count,Platform Count,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['devicetype_count'] }},{{ result['inventoryitem_count'] }},{{ result['platform_count'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/module-bay-templates/" %}
ID,Display,Name,Description,Label,Position,Device Type ID,Device Type Display,Device Type Model,Device Type Slug,Device Type URL,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['position'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['model'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['url'] }},{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/module-bays/" %}
ID,Display,Name,Description,Label,Position,Device ID,Device Name,Device Display,Device URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['position'] }},{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/module-types/" %}
ID,Display,Description,Model,Part Number,Comments,Manufacturer ID,Manufacturer Name,Manufacturer Display,Manufacturer Slug,Manufacturer URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['model'] }},{{ result['part_number'] }},{{ result['comments'] }},{{ result['manufacturer']['id'] }},{{ result['manufacturer']['name'] }},{{ result['manufacturer']['display'] }},{{ result['manufacturer']['slug'] }},{{ result['manufacturer']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/modules/" %}
ID,Display,Asset Tag,Comments,Serial Number,Device ID,Device Name,Device Display,Device URL,Module Bay ID,Module Bay Name,Module Bay Display,Module Bay URL,Module Type ID,Module Type Display,Module Type Model,Module Type URL,Module Type Manufacturer ID,Module Type Manufacturer Name,Module Type Manufacturer Display,Module Type Manufacturer Slug,Module Type Manufacturer URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['asset_tag'] }},{{ result['comments'] }},{{ result['serial'] }},{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{{ result['module_bay']['id'] }},{{ result['module_bay']['name'] }},{{ result['module_bay']['display'] }},{{ result['module_bay']['url'] }},{{ result['module_type']['id'] }},{{ result['module_type']['display'] }},{{ result['module_type']['model'] }},{{ result['module_type']['url'] }},{%- if result['module_type']['manufacturer'] is defined %}{{ result['module_type']['manufacturer']['id'] }},{{ result['module_type']['manufacturer']['name'] }},{{ result['module_type']['manufacturer']['display'] }},{{ result['module_type']['manufacturer']['slug'] }},{{ result['module_type']['manufacturer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/platforms/" %}
ID,Display,Name,Slug,Device Count,Virtual Machine Count,Manufacturer ID,Manufacturer Name,Manufacturer Display,Manufacturer Slug,Manufacturer URL,Napalm Driver,Napalm Arguments,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['slug'] }},{{ result['device_count'] }},{{ result['virtualmachine_count'] }},{{ result['manufacturer']['id'] }},{{ result['manufacturer']['name'] }},{{ result['manufacturer']['display'] }},{{ result['manufacturer']['slug'] }},{{ result['manufacturer']['url'] }},{{ result['napalm_driver'] }},{{ result['napalm_args'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/power-feeds/" %}
ID,Display,Name,Comments,Occupied,Amperage,Voltage,Mark Connected,Max Utilization,Phase Label,Phase Value,Power Panel ID,Power Panel Name,Power Panel Display,Power Panel URL,Rack ID,Rack Name,Rack Display,Rack URL,Status Label, Status Value,Supply Label,Supply Value,Type Label,Type Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['comments'] }},{{ result['_occupied'] }},{{ result['amperage'] }},{{ result['voltage'] }},{{ result['mark_connected'] }},{{ result['max_utilization'] }},{{ result['phase']['label'] }},{{ result['phase']['value'] }},{{ result['power_panel']['id'] }},{{ result['power_panel']['name'] }},{{ result['power_panel']['display'] }},{{ result['power_panel']['url'] }},{{ result['rack']['id'] }},{{ result['rack']['name'] }},{{ result['rack']['display'] }},{{ result['rack']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['supply']['label'] }},{{ result['supply']['value'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/power-outlet-templates/" %}
ID,Display,Name,Description,Label,Feed Leg,Device Type ID,Device Type Display,Device Type Model,Device Type Slug,Device Type URL,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Power Port ID,Power Port Name,Power Port Display,Power Port URL,Type Label,Type Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['feed_leg'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['model'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['url'] }},{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{{ result['power_port']['id'] }},{{ result['power_port']['name'] }},{{ result['power_port']['display'] }},{{ result['power_port']['url'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/power-outlets/" %}
ID,Display,Name,Description,Label,Occupied,Feed Leg,Device ID,Device Display,Device Name,Device URL,Power Port ID,Power Port Name,Power Port Display,Power Port Occupied,Power Port Cable,Power Port URL,Power Port Device ID,Power Port Device Name,Power Port Device Display,Power Port Device URL,Type Label,Type Value,Cable ID,Cable Display,Cable Label,Cable URL,Connected Endpoint ID,Connected Endpoint Name,Connected Endpoint Display,Connected Endpoint Occupied,Connected Endpoint Cable,Connected Endpoint URL,Connected Endpoint Device ID,Connected Endpoint Device Name,Connected Endpoint Device Display,Connected Endpoint Device URL,Connected Endpoint Reachable,Connected Endpoint Type,Link Peer ID,Link Peer Name,Link Peer Display,Link Peer Occupied,Link Peer Cable,Link Peer URL,Link Peer Device ID,Link Peer Device Name,Link Peer Device Display,Link Peer Device URL,Link Peer Type,Mark Connected,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['_occupied'] }},{{ result['feed_leg'] }},{{ result['device']['id'] }},{{ result['device']['display'] }},{{ result['device']['name'] }},{{ result['device']['url'] }},{{ result['power_port']['id'] }},{{ result['power_port']['name'] }},{{ result['power_port']['display'] }},{{ result['power_port']['_occupied'] }},{{ result['power_port']['cable'] }},{{ result['power_port']['url'] }},{%- if result['power_port']['device'] is defined %}{{ result['power_port']['device']['id'] }},{{ result['power_port']['device']['name'] }},{{ result['power_port']['device']['display'] }},{{ result['power_port']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{%- if result['connected_endpoint'] %}{{ result['connected_endpoint']['id'] }},{{ result['connected_endpoint']['name'] }},{{ result['connected_endpoint']['display'] }},{{ result['connected_endpoint']['_occupied'] }},{{ result['connected_endpoint']['cable'] }},{{ result['connected_endpoint']['url'] }},{%- if result['connected_endpoint']['device'] is defined %}{{ result['connected_endpoint']['device']['id'] }},{{ result['connected_endpoint']['device']['name'] }},{{ result['connected_endpoint']['device']['display'] }},{{ result['connected_endpoint']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['connected_endpoint_reachable'] }},{{ result['connected_endpoint_type'] }},{%- if result['link_peer'] %}{{ result['link_peer']['id'] }},{{ result['link_peer']['name'] }},{{ result['link_peer']['display'] }},{{ result['link_peer']['_occupied'] }},{{ result['link_peer']['cable'] }},{{ result['link_peer']['url'] }},{%- if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mark_connected'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/power-panels/" %}
ID,Display,Name,Location,Power Feed Count,Site ID,Site Name,Site Display,Site Slug,Site URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['location'] }},{{ result['powerfeed_count'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/power-port-templates/" %}
ID,Display,Name,Description,Label,Allocated Draw,Maximum Draw,Module Type,Type Label,Type Value,Device Type ID,Device Type Display,Device Type Model,Device Type Slug,Device Type URL,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['allocated_draw'] }},{{ result['maximum_draw'] }},{{ result['module_type'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['model'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['url'] }},{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/power-ports/" %}
ID,Display,Name,Description,Label,Allocated Draw,Maximum Draw,Module Type,Type Label,Type Value,Device ID,Device Display,Device Name,Device URL,Occupied,Cable ID,Cable Display,Cable Label,Cable URL,Connected Endpoint ID,Connected Endpoint Name,Connected Endpoint Display,Connected Endpoint Occupied,Connected Endpoint Cable,Connected Endpoint URL,Connected Endpoint Device ID,Connected Endpoint Device Name,Connected Endpoint Device Display,Connected Endpoint Device URL,Connected Endpoint Reachable,Connected Endpoint Type,Link Peer ID,Link Peer Name,Link Peer Display,Link Peer Occupied,Link Peer Cable,Link Peer URL,Link Peer Device ID,Link Peer Device Name,Link Peer Device Display,Link Peer Device URL,Link Peer Type,Mark Connected,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['label'] }},{{ result['allocated_draw'] }},{{ result['maximum_draw'] }},{{ result['module'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['device']['id'] }},{{ result['device']['display'] }},{{ result['device']['name'] }},{{ result['device']['url'] }},{{ result['_occupied'] }},{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{%- if result['connected_endpoint'] %}{{ result['connected_endpoint']['id'] }},{{ result['connected_endpoint']['name'] }},{{ result['connected_endpoint']['display'] }},{{ result['connected_endpoint']['_occupied'] }},{{ result['connected_endpoint']['cable'] }},{{ result['connected_endpoint']['url'] }},{%- if result['connected_endpoint']['device'] is defined %}{{ result['connected_endpoint']['device']['id'] }},{{ result['connected_endpoint']['device']['name'] }},{{ result['connected_endpoint']['device']['display'] }},{{ result['connected_endpoint']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['connected_endpoint_reachable'] }},{{ result['connected_endpoint_type'] }},{%- if result['link_peer'] %}{{ result['link_peer']['id'] }},{{ result['link_peer']['name'] }},{{ result['link_peer']['display'] }},{{ result['link_peer']['_occupied'] }},{{ result['link_peer']['cable'] }},{{ result['link_peer']['url'] }},{%- if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mark_connected'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/rack-reservations/" %}
ID,Display,Description,Rack ID,Rack Name,Rack Display,Rack URL,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Units,User ID,User Display,User Username,User URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['rack']['id'] }},{{ result['rack']['name'] }},{{ result['rack']['display'] }},{{ result['rack']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ")}},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['units'] | replace(","," ") | replace("[","") | replace("]","") }},{{ result['user']['id'] }},{{ result['user']['display'] }},{{ result['user']['username'] }},{{ result['user']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/rack-roles/" %}
ID,Display,Description,Name,Slug,Color,Rack Count,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['name'] }},{{ result['slug'] }},{{ result['color'] }},{{ result['rack_count'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/racks/" %}
ID,Display,Name,Comments,Asset Tag,Serial Number,Desc Units,Facility ID,Location ID,Location Name,Location Display,Location Slug,Location Depth,Location URL,Role ID,Role Name,Role Display,Role Slug,Role URL,Site ID,Site Name,Site Display,Site Slug,Site URL,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Type Label,Type Value,Status Label,Status Value,Device Count,Outer Depth,Outer Unit,Outer Width,Power Feed Count,U Height,Width Label,Width Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['comments'] }},{{ result['asset_tag'] }},{{ result['serial'] }},{{ result['desc_units'] }},{{ result['facility_id'] }},{{ result['location']['id'] }},{{ result['location']['name'] }},{{ result['location']['display'] }},{{ result['location']['slug'] }},{{ result['location']['_depth'] }},{{ result['location']['url'] }},{{ result['role']['id'] }},{{ result['role']['name'] }},{{ result['role']['display'] }},{{ result['role']['slug'] }},{{ result['role']['url'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] }},{{ result['tenant']['display'] }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['device_count'] }},{{ result['outer_depth'] }},{{ result['outer_unit'] }},{{ result['outer_width'] }},{{ result['powerfeed_count'] }},{{ result['u_height'] }},{{ result['width']['label'] }},{{ result['width']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/rear-port-templates/" %}
ID,Display,Name,Label,Module Type,Color,Device Type ID,Device Type Display,Device Type Slug,Device Type Model,Device Type Manufacturer ID,Device Type Manufacturer Name,Device Type Manufacturer Display,Device Type Manufacturer Slug,Device Type Manufacturer URL,Device Type URL,Type Label,Type Value,Positions,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['label'] }},{{ result['module_type'] }},{{ result['color'] }},{{ result['device_type']['id'] }},{{ result['device_type']['display'] }},{{ result['device_type']['slug'] }},{{ result['device_type']['model'] }},{{ result['device_type']['manufacturer']['id'] }},{{ result['device_type']['manufacturer']['name'] }},{{ result['device_type']['manufacturer']['display'] }},{{ result['device_type']['manufacturer']['slug'] }},{{ result['device_type']['manufacturer']['url'] }},{{ result['device_type']['url'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['positions'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/rear-ports/" %}
ID,Display,Name,Label,Description,Occupied,Cable ID,Cable Display,Cable Label,Cable URL,Color,Device ID,Device Name,Device Display,Device URL,Link Peer ID,Link Peer Name,Link Peer Display,Link Peer Cable,Link Peer Occupied,Link Peer Device ID,Link Peer Device Name,Link Peer Device Display,Link Peer Device URL,Link Peer URL,Link Peer Type,Mark Connected,Module,Positions,Type Label,Type Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['label'] }},{{ result['description'] }},{{ result['_occupied'] }},{{ result['cable']['id'] }},{{ result['cable']['display'] }},{{ result['cable']['label'] }},{{ result['cable']['url'] }},{{ result['color'] }},{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{%- if result['link_peer'] %}{{ result['link_peer']['id'] }},{{ result['link_peer']['name'] }},{{ result['link_peer']['display'] }},{{ result['link_peer']['cable'] }},{{ result['link_peer']['_occupied'] }},{%- if result['link_peer']['device'] is defined %}{{ result['link_peer']['device']['id'] }},{{ result['link_peer']['device']['name'] }},{{ result['link_peer']['device']['display'] }},{{ result['link_peer']['device']['url'] }},{%- else %}N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['link_peer_type'] }},{{ result['mark_connected'] }},{{ result['module'] }},{{ result['positions'] }},{{ result['type']['label'] }},{{ result['type']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/regions/" %}
ID,Display,Name,Description,Slug,Depth,Site Count,Parent ID,Parent Name,Parent Display,Parent Slug,Parent Depth,Parent URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['_depth'] }},{{ result['site_count'] }},{{ result['parent']['id'] }},{{ result['parent']['name'] }},{{ result['parent']['display'] }},{{ result['parent']['slug'] }},{{ result['parent']['_depth'] }},{{ result['parent']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/site-groups/" %}
ID,Display,Name,Description,Slug,Depth,Site Count,Parent ID,Parent Name,Parent Display,Parent Slug,Parent Depth,Parent URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['_depth'] }},{{ result['site_count'] }},{{ result['parent']['id'] }},{{ result['parent']['name'] }},{{ result['parent']['display'] }},{{ result['parent']['slug'] }},{{ result['parent']['_depth'] }},{{ result['parent']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/sites/" %}
ID,Display,Name,Description,Slug,Comments,ASN ID,ASN,ASN Display,ASN URL,Facility,Group ID,Group Name,Group Display,Group Slug,Group Depth,Group URL,Latitude,Longitude,Time Zone,Physical Address,Shipping Address,Prefix Count,Rack Count,Circuit Count,Device Count,Virtual Machine Count,VLAN Count,Region ID,Region Name,Region Display,Region Slug,Region Depth,Region URL,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Status Label,Status Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{%-         if result['asns'] %}
    {%-         for asn in result['asns'] %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['comments'] }},{{ asn['id'] }},{{ asn['asn'] }},{{ asn['display'] }},{{ asn['url'] }},{{ result['facility'] }},{{ result['group']['id'] }},{{ result['group']['name'] }},{{ result['group']['display'] }},{{ result['group']['slug'] }},{{ result['group']['_depth'] }},{{ result['group']['url'] }},{{ result['latitude'] }},{{ result['longitude'] }},{{ result['time_zone'] }},{{ result['physical_address'] | replace("\r\n"," ") | replace(","," ") }},{{ result['shipping_address'] | replace("\r\n"," ") | replace(","," ") }},{{ result['prefix_count'] }},{{ result['rack_count'] }},{{ result['circuit_count'] }},{{ result['device_count'] }},{{ result['virtualmachine_count'] }},{{ result['vlan_count'] }},{{ result['region']['id'] }},{{ result['region']['name'] }},{{ result['region']['display'] }},{{ result['region']['slug'] }},{{ result['region']['_depth'] }},{{ result['region']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
    {%-          endfor %}
{%-         else %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['comments'] }},N/A,N/A,N/A,N/A,{{ result['facility'] }},{{ result['group']['id'] }},{{ result['group']['name'] }},{{ result['group']['display'] }},{{ result['group']['slug'] }},{{ result['group']['_depth'] }},{{ result['group']['url'] }},{{ result['latitude'] }},{{ result['longitude'] }},{{ result['time_zone'] }},{{ result['physical_address'] | replace("\r\n"," ") | replace(","," ")}},{{ result['shipping_address'] | replace("\r\n"," ") | replace(","," ") }},{{ result['prefix_count'] }},{{ result['rack_count'] }},{{ result['circuit_count'] }},{{ result['device_count'] }},{{ result['virtualmachine_count'] }},{{ result['vlan_count'] }},{{ result['region']['id'] }},{{ result['region']['name'] }},{{ result['region']['display'] }},{{ result['region']['slug'] }},{{ result['region']['_depth'] }},{{ result['region']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-         endif %}
{%-     endfor %}
{%- else %}
{%- if api == "/api/dcim/virtual-chassis/" %}
ID,Display,Name,Domain,Member Count,Master ID,Master Name,Master Display,Master URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['domain'] }},{{ result['member_count'] }},{{ result['master']['id'] }},{{ result['master']['name'] }},{{ result['master']['display'] }},{{ result['master']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/status/" %}
Netbox Version,Django Version,Python Version,RQ Workers Running,Installed Applications,Plugins
{{ data_to_template['netbox-version'] }},{{ data_to_template['django-version'] }},{{ data_to_template['python-version'] }},{{ data_to_template['rq-workers-running'] }},{%- for app in data_to_template['installed-apps'] %} {{ app | replace(","," ") }} {%- endfor %},{%- for plugin in data_to_template['plugins'] %} {{ plugin | replace(",", " ") }} {%- endfor %}
{%- else %}
{%- if api == "/api/ipam/aggregates" %}
ID,Display,Description,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Prefix,Family Label,Family Value,RIR ID,RIR Name,RIR Display,RIR Slug,RIR URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ")}},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['prefix'] }},{{ result['family']['label'] }},{{ result['family']['value'] }},{{ result['rir']['id'] }},{{ result['rir']['name'] }},{{ result['rir']['display'] }},{{ result['rir']['slug'] }},{{ result['rir']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/asns/" %}
ID,Display,Description,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,ASN,Provider Count,Site Count,RIR,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['asn'] }},{{ result['provider_count'] }},{{ result['site_count'] }},{{ result['rir'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/ip-addresses/" %}
ID,Display,Description,Address,Assigned Object,Assigned Object ID,Assigned Object Type,DNS Name,Family Label,Family Value,NAT Inside,NAT Outside,Role ID,Role Name,Role Display,Role Slug,Role URL,Status Label,Status Value,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,VRF ID,VRF Name,VRF Display,VRF RD,VRF URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['address'] }},{%- if result['assigned_object']['device'] is defined %}{{ result['assigned_object']['device']['display'] }} / {{ result['assigned_object']['display'] }}{%- elif result['assigned_object']['virtual_machine'] is defined %}{{ result['assigned_object']['virtual_machine']['display'] }} / {{ result['assigned_object']['display'] }}{%- else %}{{ result['assigned_object'] }}{%- endif %},{{ result['assigned_object_id'] }},{{ result['assigned_object_type'] }},{{ result['dns_name'] }},{{ result['family']['label'] }},{{ result['family']['value'] }},{{ result['nat_inside'] }},{{ result['nat_outside'] }},{{ result['role']['id'] }},{{ result['role']['name'] }},{{ result['role']['display'] }},{{ result['role']['slug'] }},{{ result['role']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['vrf']['id'] }},{{ result['vrf']['name'] }},{{ result['vrf']['display'] }},{{ result['vrf']['rd'] }},{{ result['vrf']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/ip-ranges/" %}
ID,Display,Description,Start Address,End Address,Family Label,Family Value,Role ID,Role Name,Role Display,Role Slug,Role URL,Status Label,Status Value,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,VRF ID,VRF Name,VRF Display,VRF RD,VRF URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['start_address'] }},{{ result['end_address'] }},{{ result['family']['label'] }},{{ result['family']['value'] }},{{ result['role']['id'] }},{{ result['role']['name'] }},{{ result['role']['display'] }},{{ result['role']['slug'] }},{{ result['role']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['vrf']['id'] }},{{ result['vrf']['name'] }},{{ result['vrf']['display'] }},{{ result['vrf']['rd'] }},{{ result['vrf']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/prefixes/" %}
ID,Display,Description,Prefix,Depth,Children,Is Pool,Mark Utilized,Family Label,Family Value,Role ID,Role Name,Role Display,Role Slug,Role URL,Status Label,Status Value,Site ID,Site Name,Site Display,Site Slug,Site URL,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,VRF ID,VRF Name,VRF Display,VRF RD,VRF URL,VLAN ID,VLAN Name,VLAN Display,VLAN VID,VLAN URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['prefix'] }},{{ result['_depth'] }},{{ result['children'] }},{{ result['is_pool'] }},{{ result['mark_utilized'] }},{{ result['family']['label'] }},{{ result['family']['value'] }},{{ result['role']['id'] }},{{ result['role']['name'] }},{{ result['role']['display'] }},{{ result['role']['slug'] }},{{ result['role']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['vrf']['id'] }},{{ result['vrf']['name'] }},{{ result['vrf']['display'] }},{{ result['vrf']['rd'] }},{{ result['vrf']['url'] }},{{ result['vlan']['id'] }},{{ result['vlan']['name'] }},{{ result['vlan']['display'] }},{{ result['vlan']['vid'] }},{{ result['vlan']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/rirs/" %}
ID,Display,Name,Description,Slug,Aggregate Count,Is Private,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['aggregate_count'] }},{{ result['is_private'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/roles/" %}
ID,Display,Name,Description,Slug,Prefix Count,VLAN Count,Weight,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['prefix_count'] }},{{ result['vlan_count'] }},{{ result['weight'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/route-targets/" %}
ID,Display,Name,Description,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/service-templates/" %}
ID,Display,Name,Description,Ports,Protocol Label,Protocol Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{%- for port in result['ports'] %} {{ port }} {%- endfor %},{{ result['protocol']['label'] }},{{ result['protocol']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/services/" %}
ID,Display,Name,Description,Ports,Protocol Label,Protocol Value,IP Addresses,Device ID,Device Name,Device Display,Device URL,Virtual Machine ID,Virtual Machine Name,Virtual Machine Display,Virtual Machine URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{%- for port in result['ports'] %} {{ port }} {%- endfor %},{{ result['protocol']['label'] }},{{ result['protocol']['value'] }},{%- for ip in result['ipaddresses'] %} {{ ip }} {%- endfor %},{{ result['device']['id'] }},{{ result['device']['name'] }},{{ result['device']['display'] }},{{ result['device']['url'] }},{{ result['virtual_machine']['id'] }},{{ result['virtual_machine']['name'] }},{{ result['virtual_machine']['display'] }},{{ result['virtual_machine']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/vlan-groups/" %}
ID,Display,Name,Description,Slug,Max VID,Min VID,Scope ID,Scope Name,Scope Display,Scope Slug,Scope URL,Scope Type,VLAN Count,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['max_vid'] }},{{ result['min_vid'] }},{{ result['scope']['id'] }},{{ result['scope']['name'] }},{{ result['scope']['display'] }},{{ result['scope']['slug'] }},{{ result['scope']['url'] }},{{ result['scope_type'] }},{{ result['vlan_count'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/vlans/" %}
ID,Display,Name,Description,VID,Prefix Count,Group ID,Group Name,Group Display,Group Slug,Group URL,Role ID,Role Name,Role Display,Role Slug,Role URL,Site ID,Site Name,Site Display,Site Slug,Site URL,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Status Label,Status Value,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['vid'] }},{{ result['prefix_count'] }},{{ result['group']['id'] }},{{ result['group']['name'] }},{{ result['group']['display'] }},{{ result['group']['slug'] }},{{ result['group']['url'] }},{{ result['role']['id'] }},{{ result['role']['name'] }},{{ result['role']['display'] }},{{ result['role']['slug'] }},{{ result['role']['url'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ")}},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/ipam/vrfs/" %}
ID,Display,Name,Description,Enforce Unique,IP Address Count,Prefix Count,RD,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Export Target ID,Export Target Name,Export Target Display,Export Target URL,Import Target ID,Import Target Name,Import Target Display,Import Target URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{%-         for export_target in result['export_targets'] %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['enforce_unique'] }},{{ result['ipaddress_count'] }},{{ result['prefix_count'] }},{{ result['rd'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ")}},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ export_target['id'] }},{{ export_target['name'] }},{{ export_target['display'] }},{{ export_target['url'] }},N/A,N/A,N/A,N/A,{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-         endfor %}
{%-         for import_target in result['import_targets'] %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['enforce_unique'] }},{{ result['ipaddress_count'] }},{{ result['prefix_count'] }},{{ result['rd'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ") }},{{ result['tenant']['display'] | replace(","," ")}},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},N/A,N/A,N/A,N/A,{{ import_target['id'] }},{{ import_target['name'] }},{{ import_target['display'] }},{{ import_target['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if api == "contact-assignments" %}
ID,Display,Contact ID,Contact Name,Contact Display,Contact URL,Content Type,Object ID,Object Name,Object Display,Object Slug,Object URL,Priority Label,Priority Value,Role ID,Role Name,Role Display,Role Slug,Role URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['contact']['id'] }},{{ result['contact']['name'] }},{{ result['contact']['display'] }},{{ result['contact']['url'] }},{{ result['content_type'] }},{{ result['object']['id'] }},{{ result['object']['name'] }},{{ result['object']['display'] }},{{ result['object']['slug'] }},{{ result['object']['url'] }},{{ result['priority']['label'] }},{{ result['priority']['value'] }},{{ result['role']['id'] }},{{ result['role']['name'] }},{{ result['role']['display'] }},{{ result['role']['slug'] }},{{ result['role']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/tenancy/contact-assignments/" %}
ID,Display,Name,Description,Slug,Depth,Contact Count,Parent ID,Parent Name,Parent Display,Parent Slug,Parent Depth,Parent URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['_depth'] }},{{ result['contact_count'] }},{%- if result['parent'] %}{{ result['parent']['id'] }},{{ result['parent']['name'] }},{{ result['parent']['display'] }},{{ result['parent']['slug'] }},{{ result['parent']['_depth'] }},{{ result['parent']['url'] }},{%- else %}N/A,N/A,N/A,N/A,N/A,N/A,{%- endif %}{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/tenancy/contact-roles/" %}
ID,Display,Name,Description,Slug,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/tenancy/contacts/" %}
ID,Display,Name,Comments,Title,Address,Email,Phone,Link,Group ID,Group Name,Group Display,Group Slug,Group Depth,Group URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['comments'] }},{{ result['title'] }},{{ result['address'] | replace("\r\n"," ") | replace(","," ") }},{{ result['email'] }},{{ result['phone'] }},{{ result['link'] }},{{ result['group']['id'] }},{{ result['group']['name'] }},{{ result['group']['display'] }},{{ result['group']['slug'] }},{{ result['group']['_depth'] }},{{ result['group']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/tenancy/tenant-groups/" %}
ID,Display,Name,Description,Slug,Depth,Tenant Count,Parent ID,Parent Name,Parent Display,Parent Slug,Parent Depth,Parent URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['_depth'] }},{{ result['tenant_count'] }},{{ result['parent']['id'] }},{{ result['parent']['name'] }},{{ result['parent']['display'] }},{{ result['parent']['slug'] }},{{ result['parent']['_depth'] }},{{ result['parent']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/tenancy/tenants/" %}
ID,Display,Name,Description,Slug,Comments,Circuit Count,Cluster Count,Device Count,IP Address Count,Prefix Count,Rack Count,Site Count,Virtual Machine Count,VLAN Count,VRF Count,Group ID,Group Name,Group Display,Group Slug,Group Depth,Group URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] | replace(","," ") }},{{ result['name'] | replace(","," ") }},{{ result['description'] }},{{ result['slug'] }},{{ result['comments'] }},{{ result['circuit_count'] }},{{ result['cluster_count'] }},{{ result['device_count'] }},{{ result['ipaddress_count'] }},{{ result['prefix_count'] }},{{ result['rack_count'] }},{{ result['site_count'] }},{{ result['virtualmachine_count'] }},{{ result['vlan_count'] }},{{ result['vrf_count'] }},{{ result['group']['id'] }},{{ result['group']['name'] }},{{ result['group']['display'] }},{{ result['group']['slug'] }},{{ result['group']['_depth'] }},{{ result['group']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/users/groups/" %}
ID,Display,Name,User Count,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['user_count'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/users/tokens/" %}
ID,Display,Description,Key,Write Enabled,User ID,User Display,Username,User URL,Created,Expires,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['description'] }},{{ result['key'] }},{{ result['write_enabled'] }},{{ result['user']['id'] }},{{ result['user']['display'] }},{{ result['user']['username'] }},{{ result['user']['url'] }},{{ result['created'] }},{{ result['expires'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/users/users/" %}
ID,Display,Username,First Name,Last Name,Email,Active,Staff,Date Joined,Group ID,Group Name,Group Display,Group URL,URL
{%-     for result in data_to_template %}
{%-         for group in result['groups'] %}
{{ result['id'] }},{{ result['display'] }},{{ result['username'] }},{{ result['first_name'] }},{{ result['last_name'] }},{{ result['email'] }},{{ result['is_active'] }},{{ result['is_staff'] }},{{ result['date_joined'] }},{{ group['id'] }},{{ group['name'] }},{{ group['display'] }},{{ group['url'] }},{{ result['url'] }}
{%-         endfor %}
{%-     endfor %}
{%- else %}
{%- if api == "/api/virtualization/cluster-groups/" %}
ID,Display,Name,Description,Slug,Cluster Count,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['cluster_count'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/virtualization/cluster-types/" %}
ID,Display,Name,Description,Slug,Cluster Count,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['slug'] }},{{ result['cluster_count'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/virtualization/cluster-types/" %}
ID,Display,Name,Description,Comments,Device Count,Virtual Machine Count,Type ID,Type Name,Type Display,Type Slug,Type URL,Group ID,Group Name,Group Display,Group Slug,Group URL,Site ID,Site Name,Site Display,Site Slug,Site URL,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['comments'] }},{{ result['device_count'] }},{{ result['virtualmachine_count'] }},{{ result['type']['id'] }},{{ result['type']['name'] }},{{ result['type']['display'] }},{{ result['type']['slug'] }},{{ result['type']['url'] }},{{ result['group']['id'] }},{{ result['group']['name'] }},{{ result['group']['display'] }},{{ result['group']['slug'] }},{{ result['group']['url'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ")}},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/virtualization/interfaces/" %}
ID,Display,Name,Description,Bridge,FHRP Groups,IP Addresses,Enabled,MAC Address,Mode,MTU,Tagged VLANs,Untagged VLAN,VRF,Virtual Machine ID,Virtual Machine Name,Virtual Machine Display,Virtual Machine URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['description'] }},{{ result['bridge'] }},{{ result['count_fhrp_groups'] }},{{ result['count_ipaddresses'] }},{{ result['enabled'] }},{{ result['mac_address'] }},{{ result['mode'] }},{{ result['mtu'] }},{%- for vlan in result['tagged_vlans'] %} {{ vlan }} {%- endfor %},{{ result['untagged_vlan'] }},{{ result['vrf'] }},{{ result['virtual_machine']['id'] }},{{ result['virtual_machine']['name'] }},{{ result['virtual_machine']['display'] }},{{ result['virtual_machine']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- else %}
{%- if api == "/api/virtualization/virtual-machines/" %}
ID,Display,Name,Comments,Disk,Memory,Primary IP,Primary IPv4,Primary IPv6,Status Label,Status Value,Cluster ID,Cluster Name,Cluster Display,Cluster URL,Platform ID,Platform Name,Platform Display,Platform Slug,Platform URL,Role ID,Role Name,Role Display,Role Slug,Role URL,Site ID,Site Name,Site Display,Site Slug,Site URL,Tenant ID,Tenant Name,Tenant Display,Tenant Slug,Tenant URL,Created,Last Updated,URL
{%-     for result in data_to_template %}
{{ result['id'] }},{{ result['display'] }},{{ result['name'] }},{{ result['comments'] }},{{ result['disk'] }},{{ result['memory'] }},{{ result['primary_ip']['display'] }},{{ result['primary_ip4']['display'] }},{{ result['primary_ip6']['display'] }},{{ result['status']['label'] }},{{ result['status']['value'] }},{{ result['cluster']['id'] }},{{ result['cluster']['name'] }},{{ result['cluster']['display'] }},{{ result['cluster']['url'] }},{{ result['platform']['id'] }},{{ result['platform']['name'] }},{{ result['platform']['display'] }},{{ result['platform']['slug'] }},{{ result['platform']['url'] }},{{ result['role']['id'] }},{{ result['role']['name'] }},{{ result['role']['display'] }},{{ result['role']['slug'] }},{{ result['role']['url'] }},{{ result['site']['id'] }},{{ result['site']['name'] }},{{ result['site']['display'] }},{{ result['site']['slug'] }},{{ result['site']['url'] }},{{ result['tenant']['id'] }},{{ result['tenant']['name'] | replace(","," ")}},{{ result['tenant']['display'] | replace(","," ") }},{{ result['tenant']['slug'] }},{{ result['tenant']['url'] }},{{ result['created'] }},{{ result['last_updated'] }},{{ result['url'] }}
{%-     endfor %}
{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}{%- endif %}