{"id":104782,"date":"2024-02-01T09:26:37","date_gmt":"2024-02-01T14:26:37","guid":{"rendered":"https:\/\/jumpcloud.com\/?post_type=support&p=104782"},"modified":"2024-07-31T16:10:50","modified_gmt":"2024-07-31T20:10:50","slug":"retrieve-object-ids-from-the-api","status":"publish","type":"support","link":"https:\/\/jumpcloud.com\/support\/retrieve-object-ids-from-the-api","title":{"rendered":"Retrieve Object IDs from the API"},"content":{"rendered":"\n
JumpCloud, like many other directories, gives each object a specific or unique identifier. These objectIDs are associated with almost every item that is configurable within the platform. You may need these objectIDs if you\u2019re troubleshooting an issue, writing custom scripts, calling the API, or integrating third party apps with the JumpCloud Platform.<\/p>\n\n\n\n
In this article we\u2019ll cover the most common Object IDs and how to get them through the API<\/a> and JumpCloud PowerShell Module<\/a>.<\/p>\n\n\n\n <\/p><\/div> You can also use the Admin Portal GUI to retrieve objectIDs. See Retrieve Object IDs from the Admin Portal<\/a>. <\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n Prerequisites:<\/strong><\/p>\n\n\n\n This section covers how to locate the ObjectIDs of the most common JumpCloud objects such as Users, User Groups, Devices, Device Groups, Policies, ApplicationIDs, and more through the API and the JumpCloud PowerShell Module.<\/p>\n\n\n\n curl -X GET https:\/\/console.jumpcloud.com\/api\/systemusers?fields=id&filter=username:$eq:ENTER_USERNAME_HERE’ \\ This will print out the user\u2019s id within JumpCloud. Ensure to replace ENTER_USERNAME_HERE<\/strong> with the target user\u2019s username and replace API_KEY_GOES_HERE<\/strong> with your JumpCloud Admin API Key.<\/p>\n\n\n\n Example Output<\/p>\n\n\n\n {“totalCount”:1,”results”:[{“id”:”XXXXXXXXXXXXXXXXXabc123″,”_id”:”XXXXXXXXXXXXXXXXXabc123″}]}<\/p>\n<\/div><\/div>\n\n\n\n curl –location ‘https:\/\/console.jumpcloud.com\/api\/search\/systemusers?fields=&filter=%3Cstring%3E&limit=10&skip=0’ \\ This lets you retrieve the user id by searching for an email address. Ensure to replace the values: YOUR_ORG_ID<\/strong>, YOUR_API_KEY<\/strong>, and USER-EMAIL<\/strong>.<\/p>\n\n\n\n Example Output<\/p>\n\n\n\n {“totalCount”: 1, “results”: Get-JCUser ENTER_USERNAME_HERE | Select-Object id<\/p>\n<\/div><\/div>\n\n\n\n Example Output<\/p>\n\n\n\n id In JumpCloud, devices may also be called systems<\/em>. In the Admin Portal, the device\u2019s unique identifier is called the SystemId<\/em>. In the API, the SystemId<\/em> is refereed to as just _id<\/em> or id<\/em>. The SystemId<\/em> is also found within the Agent configuration file on the targeted device as well.<\/p>\n\n\n\n curl -X GET https:\/\/console.jumpcloud.com\/api\/systems?fields=id&filter=hostname:$eq:ENTER_HOSTNAME_HERE’ \\ This will print out the device\u2019s id within JumpCloud. Ensure you replace ENTER_HOSTNAME_HERE <\/strong>with the target device\u2019s hostname, and replace API_KEY_GOES_HERE<\/strong> with your JumpCloud Admin API Key. You can find the Hostname<\/strong> of the Device in the Admin Portal within the Details<\/strong> panel of the selected Device.<\/p>\n\n\n\n Example Output<\/p>\n\n\n\n {“totalCount”:1,”results”:[{“id”:”XXXXXXXXXXXXXXXXXaaa098″,”_id”:”XXXXXXXXXXXXXXXXXaaa098″}]}<\/p>\n<\/div><\/div>\n\n\n\n Get-JCSystem -hostname ENTER_HOSTNAME_HERE | Select-Object id<\/p>\n<\/div><\/div>\n\n\n\n Example Output<\/p>\n\n\n\n id You can use dot notation to access nested variables within API commands by filtering or searching. This method allows you to traverse through variables to locate specific values.<\/p>\n\n\n\n You get the following response for the API command.<\/p>\n\n\n\n “mdm”: { The following example retrieves the MDM internal device ID by filtering the System List<\/a> command.<\/p>\n\n\n\n mdm.internal.deviceId:$eq:<deviceID><\/p>\n<\/div><\/div>\n\n\n\n curl –location ‘https:\/\/console.jumpcloud.com\/api\/systems?filter=mdm.internal.deviceId%3A%’ \\ This approach allows the use of nested variables for efficient data retrieval and management.<\/p>\n\n\n\n curl -X GET https:\/\/console.jumpcloud.com\/api\/v2\/usergroups?fields=id&filter=name:eq:ENTER_USERGROUP_NAME_HERE’ \\ This will print out the User Group\u2019s id and other attributes within JumpCloud. Ensure you replace ENTER_USERGROUP_NAME_HERE<\/strong> with the target User Group\u2019s name, and replace API_KEY_GOES_HERE<\/strong> with your JumpCloud Admin API Key.<\/p>\n\n\n\n Example Output<\/p>\n\n\n\n [{“attributes”:null,”id”:”XXXXXXXXXXXXXXXXXfff321″,”name”:”NAME_OF_USERGROUP”,”type”:”user_group”,”email”:””,”description”:””}]<\/p>\n<\/div><\/div>\n\n\n\n Get-JCGroup User -Name NAME_OF_USERGROUP_HERE | Select-Object id<\/p>\n<\/div><\/div>\n\n\n\n Example Output<\/p>\n\n\n\n id curl -X GET https:\/\/console.jumpcloud.com\/api\/v2\/systemgroups?fields=id&filter=name:eq:ENTER_DEVICEGROUP_NAME_HERE’ \\ This will print out the Device Group\u2019s id (otherwise known as System Group) and other attributes within JumpCloud. Ensure you replace ENTER_DEVICEGROUP_NAME_HERE<\/strong> with the target Device Group\u2019s name, and replace API_KEY_GOES_HERE <\/strong>with your JumpCloud Admin API Key.<\/p>\n\n\n\n Example Output<\/p>\n\n\n\n [{“attributes”:null,”id”:”XXXXXXXXXXXXXXXXXeee789″,”name”:”NAME_OF_SYSTEMGROUP”,”type”:”system_group”,”email”:””,”description”:””}]<\/p>\n<\/div><\/div>\n\n\n\n Get-JCGroup System -Name DEVICEGROUP_NAME_HERE | Select-Object id<\/p>\n<\/div><\/div>\n\n\n\n Example Output<\/p>\n\n\n\n id curl -X GET https:\/\/console.jumpcloud.com\/api\/applications?fields=id&filter=name:$eq:ENTER_APPLICATION_NAME_HERE’ \\ This will print out the Application\u2019s id. Ensure you replace ENTER_APPLICATION_NAME_HERE<\/strong> with the target Device Group\u2019s name, and replace API_KEY_GOES_HERE<\/strong> with your JumpCloud Admin API Key.<\/p>\n\n\n\n Example Output<\/p>\n\n\n\n {“totalCount”:1,”results”:[{“id”:”XXXXXXXXXXXXXXXXXccc098″,”_id”:”XXXXXXXXXXXXXXXXXccc098″}]}<\/p>\n<\/div><\/div>\n\n\n\n Get-JcSdkApplication | where name -EQ “NAME_OF_APPLICATION” | select-object Id<\/p>\n<\/div><\/div>\n\n\n\n Example Output<\/p>\n\n\n\n id The JumpCloud API cannot filter RADIUS down to a singular network without the objectID. You can get the objectID from the Admin Portal, or via PowerShell instead. In this API endpoint, it lists all <\/strong>RADIUS servers within the organization. You will be able to see all configured RADIUS servers, their configurations, and Ids.<\/p>\n\n\n\n <\/p><\/div> JumpCloud generally recommends using PowerShell Module as it’s easier to pull information with filtering and additional arguments. The following example shows how the JumpCloud PowerShell Module is more flexible in pulling information from the API.<\/p>\n <\/div><\/div><\/div><\/div>\n\n\n\n curl -X GET https:\/\/console.jumpcloud.com\/api\/radiusservers Example Output<\/p>\n\n\n\n {“totalCount”:2,”results”:[{“_id”:”XXXXXXXXXXXXXXXXXccc456″,”id”:”XXXXXXXXXXXXXXXXXccc456″,”authIdp”:”JUMPCLOUD”,”mfa”:”ENABLED”,”name”:”RADIUS_SERVER_1″,”networkSourceIp”:”X.X.X.X”,”organization”:”XXXXXXXXXXXXXXXXXXXX”,”sharedSecret”:”SHARED_SECRET”,”userLockoutAction”:”REMOVE”,”userPasswordExpirationAction”:”REMOVE”,”userPasswordEnabled”:true,”userCertEnabled”:false,”deviceCertEnabled”:false,”caCert”:””},{…}]}<\/p>\n<\/div><\/div>\n\n\n\n Get-JcSdkRadiusServer | where name -EQ “RADIUS_SERVER_NAME_HERE” | select-object id<\/p>\n<\/div><\/div>\n\n\n\n Example Output<\/p>\n\n\n\n id curl -X GET https:\/\/console.jumpcloud.com\/api\/v2\/systemgroups?fields=id&filter=name:eq:DEVICE_POLICY_NAME_HERE’ \\ -H ‘Accept: application\/json’ \\ -H ‘Content-Type: application\/json’ \\ -H ‘x-api-key: API_KEY_GOES_HERE’ \\<\/p>\n<\/div><\/div>\n\n\n\n This will print out the Device Policy\u2019s id along with all of the other associated attributes. Ensure you replace ENTER_DEVICE_POLICY_NAME_HERE<\/strong> with the target Device Policy\u2019s name, and replace API_KEY_GOES_HERE<\/strong> with your JumpCloud Admin API Key.<\/p>\n\n\n\n If you would like to pull just the ID, we recommend using the PowerShell Module, or using additional regex commands post cURL.<\/p>\n\n\n\n Example Output<\/p>\n\n\n\n [{“template”:{“id”:”XXXXXXXXXXXXXXXXXeee000″,”name”:”DEVICE_POLICY_NAME”,”activation”:”The policy will take effect on the next reboot.”,…}}<\/span>]<\/p>\n<\/div><\/div>\n\n\n\n via PowerShell Module<\/strong><\/p>\n\n\n\n Get-JcSdkPolicy | where name -EQ “DEVICE_POLICY_NAME_HERE” | select-object id<\/p>\n<\/div><\/div>\n\n\n\n Example Output<\/strong><\/p>\n\n\n\n id If you\u2019re looking to pull the objectIDs of other objects or items within the JumpCloud platform, you can reference JumpCloud\u2019s API Documentation<\/a> or the Wiki for JumpCloud\u2019s PowerShell Module<\/a>.<\/p>\n\n\n\n\n
Retrieving ObjectIDs from the API or PowerShell Module<\/h2>\n\n\n\n
Locating the User\u2019s UserID<\/h3>\n\n\n\n
via cURL to API (Username)<\/h4>\n\n\n\n
-H ‘Accept: application\/json’ \\
-H ‘Content-Type: application\/json’ \\
-H ‘x-api-key: API_KEY_GOES_HERE’ \\<\/p>\n<\/div><\/div>\n\n\n\nvia cURL to API (User’s Email Address)<\/h4>\n\n\n\n
–header ‘x-org-id: YOUR_ORG_ID’ \\
–header ‘Content-Type: application\/json’ \\
–header ‘Accept: application\/json’ \\
–header ‘x-api-key: YOUR_API_KEY’ \\
–data ‘{“searchFilter” : {“searchTerm”: “USER-EMAIL”,”fields”: [“email”]},”fields” : “email”}’<\/p>\n<\/div><\/div>\n\n\n\n
[{“id”: “5e23**************567”, “email”: “example@myjumpcloud.com”}]}<\/p>\n<\/div><\/div>\n\n\n\nvia PowerShell Module<\/h4>\n\n\n\n
—
XXXXXXXXXXXXXXXXXabc123<\/p>\n<\/div><\/div>\n\n\n\nLocating the Device\u2019s SystemID<\/h3>\n\n\n\n
via cURL to API<\/h4>\n\n\n\n
-H ‘Accept: application\/json’ \\
-H ‘Content-Type: application\/json’ \\
-H ‘x-api-key: API_KEY_GOES_HERE’ \\<\/p>\n<\/div><\/div>\n\n\n\nvia PowerShell Module<\/h4>\n\n\n\n
—
XXXXXXXXXXXXXXXXXaaa098<\/p>\n<\/div><\/div>\n\n\n\nRetrieving Nested Values<\/h4>\n\n\n\n
“vendor”: “internal”,
“profileIdentifier”: “com.jumpcloud.mdm”,
“dep”: false,
“userApproved”: true,
“enrollmentType”: “unknown”,
“enrollmentAttempts”: 0,
“createdAt”: “2024-03-07T20:36:15.779Z”,
“internal”: {
“deviceId”: “1234”, <<=== Value we are targeting
“windowsDeviceId”: “”
},<\/p>\n<\/div><\/div>\n\n\n\n\n
\n
\n\n
–header ‘x-api-key: API_KEY_GOES_HERE’<\/p>\n<\/div><\/div>\n\n\n\nLocating the User Group ID<\/h3>\n\n\n\n
via cURL to API<\/h4>\n\n\n\n
-H ‘Accept: application\/json’ \\
-H ‘Content-Type: application\/json’ \\
-H ‘x-api-key: API_KEY_GOES_HERE’ \\<\/p>\n<\/div><\/div>\n\n\n\nvia PowerShell<\/h4>\n\n\n\n
—
XXXXXXXXXXXXXXXXXfff321<\/p>\n<\/div><\/div>\n\n\n\nLocating Device Group ID<\/h3>\n\n\n\n
via cURL to API<\/h4>\n\n\n\n
-H ‘Accept: application\/json’ \\
-H ‘Content-Type: application\/json’ \\
-H ‘x-api-key: API_KEY_GOES_HERE’ \\<\/p>\n<\/div><\/div>\n\n\n\nvia PowerShell Module<\/h4>\n\n\n\n
—
XXXXXXXXXXXXXXXXXeee789<\/p>\n<\/div><\/div>\n\n\n\nLocating SSO Application ID<\/h3>\n\n\n\n
via cURL to API<\/h4>\n\n\n\n
-H ‘Accept: application\/json’ \\
-H ‘Content-Type: application\/json’ \\
-H ‘x-api-key: API_KEY_GOES_HERE’ \\<\/p>\n<\/div><\/div>\n\n\n\nvia PowerShell Module<\/h4>\n\n\n\n
—
XXXXXXXXXXXXXXXXXccc098<\/p>\n<\/div><\/div>\n\n\n\nLocating RADIUS NetworkID<\/h3>\n\n\n\n
via cURL to API<\/h4>\n\n\n\n
-H ‘Accept: application\/json’ \\
-H ‘Content-Type: application\/json’ \\
-H ‘x-api-key: API_KEY_GOES_HERE’ \\<\/p>\n<\/div><\/div>\n\n\n\nvia PowerShell Module<\/h4>\n\n\n\n
—
XXXXXXXXXXXXXXXXXccc456<\/p>\n<\/div><\/div>\n\n\n\nLocating Device PolicyID<\/h3>\n\n\n\n
via cURL to API<\/h4>\n\n\n\n
—
XXXXXXXXXXXXXXXXXeee000<\/p>\n<\/div><\/div>\n\n\n\nOther objects within JumpCloud<\/h3>\n\n\n\n