### Get Device URLs Response Example Source: https://api.device42.com/ Example JSON response containing a list of device web links. ```json { "device_weblinks": [ { "device": "NHCTWS001", "host": " /v:{{device.name}}", "id": 2, "notes": "TESTSERVER NHCT", "port": "", "type": "rdp", "url_suffix": " /f /restrictedadmin" } ], "code": 0 } ``` -------------------------------- ### Example Building Data (GET) Source: https://api.device42.com/ This is an example of the JSON response when retrieving a building's details. It includes fields like address, name, and contact information. ```json { "address": "879 main st", "building_id": 3, "contact_name": "roger", "custom_fields": [], "groups": "Prod_East:no, Corp:yes", "name": "Las Vegas Office", "notes": "super critical", "tags": [], "longitude": "60", "latitude": "30", "contact_phone": "" } ``` -------------------------------- ### Get Device Layout Example Source: https://api.device42.com/ This snippet provides an example JSON response for the device layout endpoint. It includes details about the device's properties and its components. ```json { "name": "Physical Device Test", "is_blade": false, "is_blade_chassis": true, "is_switch": false, "parts": [], "direct_ports": [], "id": 12, "blades": [] } ``` -------------------------------- ### Example Response for Get Asset Details Source: https://api.device42.com/ This is an example of a successful response when retrieving asset details. It includes various attributes of the asset. ```json { "asset_contracts": [], "asset_id": 16, "asset_no": "0075", "asset_purchases": [], "building": "New Haven", "custom_fields": "", "depth": "Half Depth", "imagefile_id": 2, "name": "DC1R5PP1", "notes": "", "orientation": "Front", "patch_panel_model_id": 5, "rack": "NH-DC1-05", "rack_id": 24, "room": "NHDC1", "row": 2, "serial_no": "", "service_level": "In Service", "size": 2, "start_at": 40, "type": "Patch Panel", "vendor": "Black Box Corp.", "vendor_id": 36, "where": "Rack Mounted" } ``` -------------------------------- ### Response Example for Getting a Direct Port Source: https://api.device42.com/ This is an example of a successful response when retrieving direct port details. ```json { "direct_port": { "hardware": "Manual Hardware Model", "orientation": 1, "x_pos": "10", "hardware_id": 1, "port_type_id": 1, "port_name": "Port 1", "port_type": "1-Gbps Ethernet", "y_pos": "20", "id": 1, "location": "1" } } ``` -------------------------------- ### Response Example for Getting Switch Ports Source: https://api.device42.com/ This is an example of a successful response when retrieving switch ports. It includes pagination details and a list of switch port objects. ```json { "limit": 3, "offset": 0, "switchports": [ { "description": "FastEthernet0/21", "devices": "nh-hyperv-02", "is_connected": "yes", "mac_ids": "61; 60", "macs": "00:15:5d:0b:9e:02; 00:1c:c4:44:d1:32", "normalized_port": "FastEthernet0000/0021", "obj_label": "Hyper-V Virtual Ethernet Adapte", "port": "FastEthernet0/21", "switch": { "asset_no": "", "device_id": 1, "device_url": "/api/api/1.0/devices/id/1/", "name": "nh-lab-switch-01", "serial_no": "FAB0447Y35M", "type": "physical", "uuid": "" }, "switchport_id": 10, "tags": [], "type": "", "vlan_ids": "14", "vlans": "default" } ], "total_count": 349 } ``` -------------------------------- ### Example Response for Get Switch Templates Source: https://api.device42.com/ This is an example of the JSON response when retrieving switch templates. It lists each template with its type, ID, and name. ```json [ { "switch_type": "Modular/Distributed (Single)", "template_id": 2, "template_name": "m3" } ] ``` -------------------------------- ### Get Software License Keys Response Source: https://api.device42.com/ Example response for retrieving software license keys. It includes details like count, ID, key, notes, and associated software information. ```json { "software_license_keys": [ { "count": 1, "id": 1, "key": "124124", "notes": "", "software_id": 114, "software_name": "accountsservice" } ] } ``` -------------------------------- ### Get Device Impact List Example Source: https://api.device42.com/ This snippet shows an example JSON response for the device impact list endpoint. It details the hierarchical structure of device dependencies. ```json { "children": [ { "children": [ { "children": [ { "children": [ { "duplicate": "yes", "name": "site2.com - webserver.dev" } ], "name": "Dependant Apps" } ], "duplicate": "yes", "name": "Apache HTTP Server - Production Site" } ], "duplicate": "yes", "name": "Apache Tomcat server" } ], "name": "Dependant Apps" } ``` -------------------------------- ### Example Purchase Response Source: https://api.device42.com/ An example JSON response for the 'Get All Purchases' API call, illustrating the structure of purchase data including custom fields. ```json { "purchases": [ { "purchase_id": "1", "po_date": "null", "vendor": "Amazon", "building": "West Haven Office", "order_no": "9000000001", "line_items": [], "notes": "null", "line_items_one_time_cost": "0", "customer": "Device42", "cost": "100.00", "groups": "", "completed": "no", "custom_fields": [] } ] } ``` -------------------------------- ### Example Response for GET /api/1.0/auto_discovery/vserver/ Source: https://api.device42.com/ Illustrates the structure of the response when retrieving vServer autodiscovery jobs. It includes details like job ID, target, and port. ```json { "jobs": [ { "url_prefix": "https", "job_id": 54, "name": "vserverjob54", "port": 443, "target": "192.168.11.21" } ] } ``` -------------------------------- ### Part Model Response Example Source: https://api.device42.com/ Example JSON response structure for the 'get all part models' endpoint, detailing available fields for each part model. ```json { "limit": 2, "offset": 0, "partmodels": [ { "available": 2, "cores": 4, "cpuspeed": 3400, "description": "3.4GHz (3.9GHz Turbo)", "in_devices": 0, "in_rma": 0, ``` -------------------------------- ### Application Components Response Source: https://api.device42.com/ Example response for the 'Get all application components' endpoint. It lists application components with their respective IDs, URLs, and names. ```json { "appcomps": [ { "appcomp_id": 33, "appcomp_url": "/api/api/1.0/appcomps/33/", "name": "Device42 Production" } ] } ``` -------------------------------- ### Get Services API Example Source: https://api.device42.com/ Retrieves a list of services from the Device42 API. This endpoint can be filtered by service ID, name, category, and vendor. The response includes details such as category, vendor, description, tags, notes, service type, display name, and ID. ```json { "services": [ [ { "category": "", "vendor": "", "description": "", "tags": [], "notes": "", "service-type": "null", "displayname": "apport-autoreport", "id": 2 }, { "category": "", "vendor": "", "description": "", "tags": [], "notes": "", "service-type": "null", "displayname": "apport-forward@", "id": 3 } ] ] } ``` -------------------------------- ### Example Response for Add/Update Device CPU Source: https://api.device42.com/ This is an example of a successful response when adding or updating a device CPU. ```json { "msg": [ "device cpu successfully added/updated", 28, "cpu1 : Hard Disk sda 10 GB, storage" ], "code": 0 } ``` -------------------------------- ### Software Details Response Example Source: https://api.device42.com/ An example response when querying for software details. It includes a 'limit' and 'offset' for pagination, and a list of 'software_details' objects, each containing information about a software instance on a device. ```json { "limit": 3, "offset": 0, "software_details": [ { "count_in_licensing": true, "device": "d42laptop01", "device_id": "ovh01-w2012-04", "first_detected": "2015-05-20T12:33:13.343Z", "id": "108", "install_date": "", "last_updated": "2016-04-08T16:14:04.612Z", "license_use_count": "1.0$", "software": "Hyper-V Tools", "software_alias": "", "software_id": "108", "user": "", "user_id": "", "vendor": "Probus-IT", "vendor_id": "62", "version": "2.03.00.04" } ] } ``` -------------------------------- ### Example Response for Getting Certificate Jobs Source: https://api.device42.com/ An example of the JSON response when retrieving certificate autodiscovery jobs. It lists details for each configured job. ```json { "jobs": [ { "end_ip_address": "10.42.42.100", "follow_chain": "no", "job_id": "1", "name": "D42", "ports": "443", "start_ip_address": "10.42.42.0" } ] } ``` -------------------------------- ### Get All Devices (Brief) Source: https://api.device42.com/ Retrieves a brief list of all devices in the system. This is a v1 API endpoint. ```bash curl -X GET http://localhost:4200/api/1.0/devices/ ``` -------------------------------- ### Retrieve Passwords API Example Source: https://api.device42.com/ This example demonstrates how to retrieve usernames and passwords using the Device42 API. Requires superuser privileges. ```json { "Passwords": [ { "username": "sharepointadmin", "last_pw_change": "2013-11-05T19:29:35Z", "notes": "", "label": "sharepoint admin account", "first_added": "2013-11-05T19:07:05.534Z", "password": "L8tirgcd&Loh", "id": 5 } ] } ``` -------------------------------- ### Example Response for Create/Update Device Custom Fields Source: https://api.device42.com/ This is an example of a successful response when creating or updating custom fields for a device. ```json { "msg": [ "custom key pair values added or updated", 8, "nh-switch-01" ], "code": 0 } ``` -------------------------------- ### Subnet List Example Response Source: https://api.device42.com/ Example response body for the 'Get All Subnets' endpoint, showing subnet details like network, mask, and description. ```json { "limit": 2, "offset": 0, "subnets": [ { "allocated": "no", "allow_broadcast_address": "no", "allow_network_address": "no", "assigned": "no", "can_edit": "yes", "category_id": "", "category_name": "", "custom_fields": [], "customer_id": 9, "description": "Infrastructure Devices", "gateway": "", "mask_bits": 24, "name": "Infra", "network": "10.1.10.0", "notes": "", "parent_subnet_id": "", "parent_vlan_id": "", "parent_vlan_name": "", "parent_vlan_number": "", "range_begin": "10.1.10.5" } ], "total_count": 1 } ``` -------------------------------- ### Example Response for Get Business Service Attachment Source: https://api.device42.com/ Example JSON response when retrieving a business service attachment. The response includes a file_download object. ```json { "file_download": "attachment_1.txt" } ``` -------------------------------- ### Device Cloud Instance Response Example Source: https://api.device42.com/ This is an example of the JSON response when successfully creating or updating a device cloud instance. It includes details about the associated device. ```json { "devices": [ { "name": "320", "serial_no": "null", "asset_no": "null", "preferred_alias": "null", "device_url": "/api/api/1.0/devices/id/34/", "device_id": "34", "type": "physical", "uuid": "07FCE572-B2B3-B44C-BB1C-6799B509CC31" } ] } ``` -------------------------------- ### Create/Update Hardware Model API Call Source: https://api.device42.com/ This example demonstrates how to create or update hardware model information using a POST request to the /api/2.0/hardwares/ endpoint. The response indicates success and provides details about the operation. ```bash curl -X POST https://:4265/api/2.0/hardwares/ \ -u : \ -d '{"name": "New Hardware Model", "vendor_id": 123, "part_number": "PN12345"}' ``` ```json { "code": 0, "msg": [ "hardware model added or updated", 1, "hardware_model", true, true ] } ``` -------------------------------- ### Device Response Example (JSON) Source: https://api.device42.com/ This is an example of the JSON response received when successfully retrieving device details. It includes various attributes of the device. ```json { "Devices": [ { "aliases": [ "device.domain" ], "asset_no": "null", "category": "Development Machine", "cpucore": "2", "cpucount": "1", "cpuspeed": "3300.0", "custom_fields": [], "customer": "Finance Group", "customer_id": "3", "device_external_links": [], "device_purchase_line_items": [], "hdd_details": "", "hddcount": "", "hddraid": "", "hddraid_type": "", "hddsize": "", "hw_depth": 1, "hw_model": "ProLiant DL360 G7", "hw_size": "1.0", "in_service": false, "ip_addresses": [ { "ip": "10.1.10.11", "label": "", "macaddress": "00:14:bf:aa:46:18", "subnet": "Infra-10.1.10.0/24(Infrastructure Services)", "subnet_id": "4", "type": "1" } ], "last_updated": "2014-01-07T02:23:36.350Z", "mac_addresses": [ { "mac": "00:15:5d:0b:72:0b" } ], "manufacturer": "", "name": "d42-231", "notes": "", "os": "", "ram": "512.000", "serial_no": "", "service_level": "QA", "type": "virtual", "ucs_manager": "", "uuid": "6BB7DC86-D744-8943-B991-B6BF82B55F99", "virtual_host_name": "HYPER01", "agent_version": "18.00.00.1649418756", "agent_last_checkin_date": "April 22, 2022, 5:51 p.m." } ] } ``` -------------------------------- ### Get All PDUs API Response Example Source: https://api.device42.com/ This is an example of the JSON response when retrieving all PDUs from the API. It includes details about the total count, offset, and a list of PDU objects. ```json { "total_count": 24, "offset": 0, "pdus": [ { "building": "West Haven Office", "pdu_id": 1, "name": "Sentry / ADTK0000001 / 10.42.10.9", "pdu_model": { "pdu_model_id": 1, "sequential_numbering_for_ports": true, "name": "CWG-8H1A114", "width": "null", "notes": "", "height": "null", "size": 2, "description": "", "width_ratio": 2520, "ports in pdu model": [], "back_image": "null", "type": "pdu", ``` -------------------------------- ### Example Response for Creating/Updating Application Component Source: https://api.device42.com/ This is an example of a successful response when creating or updating an application component. It confirms the action and provides a status code. ```json { "msg": [ "Application Component added or updated.'35'Corp Wiki", true, true ], "code": 0 } ``` -------------------------------- ### Example Response for Cloud Resources Source: https://api.device42.com/ Provides an example of the JSON response when querying for cloud resources. It includes the total count and an array of resource objects with their details. ```json { "total_count": 128, "resource": [ { "category": "Device", "zones": "usa-east-2a", "identifier": "i-0d90158f3cf3e7e19", "tags": "", "name": "d42-internal", "notes": "oracle cloud", "last_changed": "2020-06-19T16:13:18.225Z", "subtype": [], "cloud_infra_id": 2, "region": "usa-east-2", "root_resource_id": 2, "root_resource": "wbd42pstgr1", "last_edited": "2020-06-19T16:13:18.229Z", "first_added": "2020-06-19T16:13:18.229Z", "id": 3, "resource_storage": [] } ] } ``` -------------------------------- ### Example Response for Adding/Updating Power Unit in Rack Source: https://api.device42.com/ This is an example of a successful response when adding or updating Power Unit rack information. It confirms the successful operation and provides relevant details. ```json { "msg": [ "Power Unit Rack Info successfully added/edited.", 19, "a3cpdu001", true, false ], "code": 0 } ``` -------------------------------- ### Example Response for Get Nmap Jobs Source: https://api.device42.com/ An example of the JSON response when retrieving Nmap autodiscovery jobs. It includes details for each job such as ID, schedule, and target IPs. ```json { "jobs": [ { "job_id": 1, "schedule_time": "", "schedule_day": "", "end_ip": "", "start_ip": "", "target": "10.42.0.1-10.42.0.10, 10.42.1.0/24, device42-sandbox, device42-prod", "exclude_targets": "10.42.0.3, 10.42.1.42-10.42.1.50, device42-prod", "name": "Nmap-job-1" } ] } ``` -------------------------------- ### Get All Admin Groups API Response Source: https://api.device42.com/ This is an example response for the GET /api/1.0/admingroups/ endpoint, showing the structure of returned admin group data, including IDs, members, and names. ```json { "admingroups": [ { "id": 6, "members": [ "User1", "User2" ], "name": "System Generated Read, Add and Edit" } ], "total_count": 1, "limit": 1000, "offset": 0 } ``` -------------------------------- ### Create/Update Enduser Response Example Source: https://api.device42.com/ This is an example of a successful response when creating or updating an enduser. It includes a message and a code indicating the operation status. ```json { "msg": [ "enduser added or updated", 11, "Milton" ], "code": 0 } ``` -------------------------------- ### Get Subnet by ID - Response Example Source: https://api.device42.com/ This is an example of a successful JSON response when retrieving subnet details. It includes various attributes of the subnet such as network address, mask bits, and associated IDs. ```json { "allocated": "no", "allow_broadcast_address": "no", "allow_network_address": "no", "assigned": "no", "can_edit": "yes", "category_id": "", "category_name": "", "custom_fields": [], "customer_id": 9, "description": "Infrastructure Devices", "gateway": "", "mask_bits": 24, "name": "Infra", "network": "10.1.10.0", "notes": "", "parent_subnet_id": "", "parent_vlan_id": "", "parent_vlan_name": "", "parent_vlan_number": "", "range_begin": "10.1.10.5", "range_end": "10.1.10.254", "service_level": "Production", "subnet_id": 4, "tags": [], "vrf_group_id": 1, "vrf_group_name": "Infrastructure Services" } ``` -------------------------------- ### Get Subnet by ID - API Request Example Source: https://api.device42.com/ This example shows how to retrieve a specific subnet's details using its unique identifier. Ensure the subnet_id is correctly provided in the URL path. ```bash curl -X GET "https://your-device42-instance.com/api/1.0/subnets/4/" \ -u "your_username:your_api_password" ``` -------------------------------- ### Example Response for Get DNS Jobs Source: https://api.device42.com/ Illustrates the structure of a successful response when retrieving DNS autodiscovery jobs. ```json { "jobs": [ { "nameserver": "192.168.11.104", "zonename": "10.10.in-addr.arpa", "job_id": "10", "schedule": "M T W Th F S Su 09:44:18 ; M T F S Su 09:44:23 ;" } ] } ``` -------------------------------- ### Example Response for Saved DOQL Query Source: https://api.device42.com/ Example JSON response when retrieving a specific saved DOQL query. ```json { "name": "Power_outlet1", "tags": "power", "include_headers": true, "notes": "", "saved_query": "select * from view_rudata_v2", "output_type": "csv", "id": 182 } ``` -------------------------------- ### Example Response for Get Service Listener Port by ID Source: https://api.device42.com/ This is an example of a successful response when retrieving a service listener port by its ID. It includes details such as discovered service, mapped service, protocol, device name, and IP addresses. ```json { "service_ports": { "discovered_service": "exim4", "mapped_service": "exim4", "protocol": "tcp", "id": 3, "device_name": "D42_Test_Device", "listening_ip": "127.0.0.1", "remote_ips_ids": "", "appcomp_ids": "", "remote_ips": "", "port": 25 } } ``` -------------------------------- ### Example Service Client Connections Response Source: https://api.device42.com/ An example JSON response for service client connections, showing pagination and details of a single client connection. ```json { "total_count": 1, "offset": 0, "limit": 1000, "client_connections": [ { "listener_device_id": "null", "client_service_id": 151, "stats": [], "client_device_id": 3, "listener_mapped_service": "null", "listener_discovered_service": "null", "listener_mapped_service_id": "null", "client_ip": "10.90.6.15", "listener_device": "null", "client_service": "systemd-resolved", "port": 80, "client_device": "peter-ubu1604-90615.device42.pvt", "client_process_name": "/usr/bin/wget -q -O - http://169.254.169.254/latest/dynamic/instance-identity/document", "client_process_display_name": "wget", "id": 2, "listener_ip": "169.254.169.254", "type": 0, "listener_discovered_service_id": "null", "service_port_ip_id": "null" } ] } ``` -------------------------------- ### Get All End Users API Response Example Source: https://api.device42.com/ This is an example of the JSON response when retrieving all end users via the API. It includes details such as domain, name, notes, email, contact, location, AD username, and ID for each user. ```json { "values": [ { "domain": "internal.dev", "name": "Thom Yorke", "notes": "OK Computer", "email": "tyorke@somedomain.net", "contact": "phone: 203-555-5555", "location": "Not Here", "adusername": "None", "id": "132" } ] } ``` -------------------------------- ### Create/Update Service API Example Source: https://api.device42.com/ Creates or updates a service in Device42. Parameters include name, display name, category, service type, vendor, description, and notes. The response indicates success and provides details about the added/updated service. ```json { "msg": [ "service added/updated", 2, "DisplayLinkManager", true, false ], "code": 0 } ``` -------------------------------- ### Get Custom Fields Example Source: https://api.device42.com/ Retrieves custom fields for a specified object name. Ensure the object_name parameter is correctly set. ```json { "custom_fields": [ { "id": 2, "key": "room", "type_id": 1, "type": "Text", "filterable": "false", "mandatory": "true", "fk_model_id": "null", "fk_model_input": "null", "log_for_api": "true", "is_multi": "false", "picklist": "null" } ] } ``` -------------------------------- ### Example 200 OK Response for App Component Template Source: https://api.device42.com/ This is an example of a successful response when creating or updating an application component template. It confirms the action and provides a template identifier. ```json { "msg": [ "Application Component Template added or updated. App-Comp_Template-3", true, true ], "code": 0 } ``` -------------------------------- ### Get All Circuits Response (Status 200) Source: https://api.device42.com/ This is an example of a successful response when retrieving all circuits. It details the structure of the circuit object and its associated properties. ```json { "circuits": [ { "ID": 1, "bandwidth": "", "circuit_id": "L3-01", "custom_fields": [ { "key": "Region", "notes": "", "value": "APAC" } ], "customer": "ABC Inc.", "end_point_id": 124, "end_point_type": "patch_panel_port", "notes": "", "origin_id": 193, "origin_type": "vendor", "origin_vendor": "TF1", "provision_date": "", "turn_on_date": "", "type": "Dedicated Ethernet", "vendor": "", "full_path_list": [ { "type": "organisation", "id": 193, "name": "TF1" }, { "type": "circuit", "id": 1, "name": "L3-01" }, { "type": "patch_panel_port", "id": 124, "name": "MDF-CORE-A : 24" } ] } ] } ``` -------------------------------- ### Add URL to Device Response Example Source: https://api.device42.com/ Example JSON response indicating successful saving of a device URL. ```json { "msg": [ "Device url saved succesfully.", 2, "http://www.device42.com:8080/awesome" ], "code": 0 } ``` -------------------------------- ### Get All vServer Autodiscovery Jobs Source: https://api.device42.com/ Retrieves a list of all configured vServer autodiscovery jobs. This is useful for auditing or understanding the current discovery setup. ```bash curl -X GET "https://your_device42_instance/api/1.0/auto_discovery/vserver/" ``` -------------------------------- ### Get Racks API Response (Status 200) Source: https://api.device42.com/ This is an example of a successful response when retrieving rack information. It details the structure of the 'racks' object and its properties. ```json { "limit": 2, "offset": 0, "racks": [ { "asset_no": "", "available_u": 45, "building": "Building", "col_size": 1, "custom_fields": [], "first_number": 1, "groups": "", "manufacturer": "APC Inc.", "name": "RA1", "notes": "", "number_between_us": true, "numbering_start_from_bottom": "yes", "rack_id": 255, "rack_middle_option": "End at", "rack_url": "/api/api/1.0/racks/255/", "room": "Main room", "row": "", "row_size": 1, "size": "45", "start_col": 4, "start_row": 2, "tags": [] } ], "total_count": 275 } ``` -------------------------------- ### Response Example for Adding Switch Ports Source: https://api.device42.com/ This is an example of a successful response when adding switch ports. It confirms the successful addition and provides a status code. ```json { "msg": [ "switchports successfully added '337' oxctrouter" ], "code": 0 } ``` -------------------------------- ### Get Backup Schedules Response (200 OK) Source: https://api.device42.com/ Example JSON response when successfully retrieving backup schedules. It lists jobs with their respective IDs, methods, and names. ```json { "jobs": [ { "job_id": 1, "method": 3, "name": "test" } ] } ``` -------------------------------- ### Response Example for Adding a Direct Port Source: https://api.device42.com/ This is an example of a successful response when adding or updating a direct port. ```json { "msg": [ "direct port added/updated", 1, true ], "code": 0 } ``` -------------------------------- ### Example Response for Get AWS Role Source: https://api.device42.com/ Shows the structure of the JSON response when retrieving an AWS Role. It details the role's properties and its linked AWS accounts. ```json { "id": 2, "role_name": "example role", "role_description": "An Example AWS Role", "name": "Example Role", "accounts": [ { "id": 3, "aws_account_id": "123456789012", "aws_role_id": 1 } ] } ```