Skip to main content

I’m using the API to delete (remove the contents of) custom fields for users who are banned. So I can use something like this:

https://api2-us-west-2.insided.com/user/12345/profile_field/Company

That works fine. The problem is that we have a field called “A bit about yourself”, which obviously has spaces in there. How do I encode that in the URL?! I’ve tried:

api2-us-west-2.insided.com/user/12345/profile_field/A bit about yourself
api2-us-west-2.insided.com/user/12345/profile_field/A%20bit%20about%20yourself
api2-us-west-2.insided.com/user/12345/profile_field/A+bit+about+yourself
api2-us-west-2.insided.com/user/12345/profile_field/Abitaboutyourself

And none of these work. The “Abitaboutyourself” returns a field doesn’t exist message. The others all return “{"message":"no Route matched with those values"}:” (404 error).

Does anyone how a clue how these are meant to be formatted? Or am I out of luck and it just won’t work?!

A_bit_about_yourself


Let’s say Gainsight provides clarification and the answer isn’t ideal; something like “that won’t work because of the spaces.” (I hope that’s not the case)

A possible work around might be to 

  1. Rename the field to something short
  2. Run your clean up API
  3. Rename the field back

A_bit_about_yourself

It’s a good idea… but it doesn’t work either. ChatGPT has no other suggestions either. I’m coming to the conclusion url encoding wasn't taken into account with the field name. In the doc for Update Field it actually states for the new value to be encoded, but not the field name, so I think that’s a confirmation.

--------

Ultimately, what I’m trying to do is empty the profile fields for a user when they are banned, because the ban button doesn’t do that and the fields (including dodgy URLs and NSFW avatars) are still publicly visible. For example, this (SFW) joker!

I don’t see a way to mass update profile fields in the backend, and deleting the user isn’t viable because they’ll still have an account in our SSO system and could sign back in and start spamming again.

Hence the API use. I don’t think renaming the field is viable either, because I’d probably have to do it every day. Huh. It’s very vexing!

Thanks for your suggestions. Let’s see what Gainsight think.


The good news is that Gainsight confirmed and fixed the problem. You can now update profile fields with spaces in their names by using the %20 character, e.g.

api2-us-west-2.insided.com/user/12345/profile_field/A%20bit%20about%20yourself

Thanks to Gainsight for the fix. Much appreciated.


Ah that’s great to hear ​@FMEEvangelist !  :)


Reply