Solved

Best way to update custom fields for users through the API?


Hi everyone, I’m wondering if anyone has recommendations for the best way for updating user custom fields through the IIQ API.

Right now, I’m able to update user custom fields with a POST to “/api/v1.0/users/{User_ID}”, but I must include all of the user’s details in each POST so they don’t get replaced with null/blank values.

For example, if I only include the custom field information (CustomFieldValues, CustomFieldTypeId, Value) and UserId (as well as all other required fields) in the POST, this will successfully update the custom field, but blank the rest of the optional user profile information. Their name, email, username, etc will be gone if I don’t GET it first and include it in the POST.

Is there any way to target changes to only specific custom fields of the user without needing reapply all of the user’s other fields? Maybe an API call I’m unaware of?

Ultimately, I’ll be using this in a custom connector for a Power Automate flow. But it can be time consuming to parse json to every single user field when I’m only needing to update a couple of their custom fields. And although our IIQ user profiles sync with Azure daily, I’m afraid of missing a field or possibly messing up their profiles until the next sync.

Hopefully that makes some sense. I’d be happy to provide more details or examples if that helps. I’ll add that I’m fairly new to working with API’s in general.

icon

Best answer by bclark 13 May 2024, 22:16

View original

5 replies

Userlevel 7
Badge +12

@zjksd Thank you for submitting your question to our community! 😄

I have reached out to our Support Team about this one, but curious if one of our API gurus has any insight. @curtis.bohlmeyer @bclark , any thoughts on this one? 

Userlevel 6
Badge +10

My experience (plus some stuff I’ve been told by support) says any info you don’t want to lose you need to re-send or it’s going to be removed. I sent a custom field to a MacBook and afterwards the only data it retained was the Asset Tag. the rest such as client and serial number were removed. Fortunately it was my machine so I could easily get the info back in iiQ.

Thank you for confirming, @bclark. I just wanted to make sure I wasn’t missing something obvious, but that sounds like that’s the way this works. I have my flow working okay now by re-sending all fields. So, we can consider this answered unless someone else chimes in with new info. Appreciate it!

Userlevel 1
Badge +2

Good Afternoon @zjksd and @bclark 

I hope you are both doing well so far today and thank you for jumping in as well Brent! 

In my experience with the API and after discussing with my Team, I am able to confirm that Brent is correct that for any information you would not like removed, that you will want to include this information in the API call. For Custom Field values in particular, these fields are stored as an array in Incident IQ, so if any information is left out of the array during the update, then the other custom field information which was left out will be set to null on the user profile by the call. 

With that said though, we do have an API header that I wanted to bring to your attention though which may help with smaller scale updates made via API. If a Header is added for “APIFlags: OnlySetMappedProperties”, then your district may be able to shorten the API call so that less information is required. Unfortunately I believe that the entire custom field information will still need to be included in order to ensure this information remains on the user, but this Header may be able to help shorten the call and what additional information may be required. I would definitely recommend running some test API calls with the Header first though before making large scale changes to ensure that information will update the way you intend.

Best,
Drew

Thanks Drew! I’ll give that a try. This also helped me realize that I might be missing some other custom fields since the test user I’m running this on only had the fields I was targeting this automation on.

Reply