API GET Item Empty Custom Fields Workaround

Alex Bruno
Alex Bruno Member, Data Exchange Posts: 1

Hello,

I've been running into an issue with the API not returning fields when using a GET /items/[id] call if the particular field for that particular item is empty. This is incredibly frustrating, as it would seem I cannot set up a robust automated script to be used for that data type without tacking on a bunch of conditionals to check that those fields exist, otherwise it'll randomly throw an error depending on the specific items being reported on.

After some searching through these forums, it would seem this is known and may even be intended behavior? Reference threads here and here. Neither of those threads note how to work around it or even why this is the behavior. 

My question is, is there any setting or call or workaround I can use with the GET /items/[id] call that will return all of the fields, regardless of their contents? My only options right now are to validate that every field (or at least the rich text ones) exist in the API response, or to maybe try to pull a list of the fields from GET /itemtypes/{itemTypeId} and somehow stitch it back together? I'd rather avoid those if possible.

Thank you!!!

------------------------------
Alex Bruno
Axiom Space
------------------------------

Comments

  • [Deleted User]
    [Deleted User] Posts: 152
    edited August 2023

    Hi Alex, 

    The behaviour you're describing is by design, in order to reduce the payload size. While there isn't a process that'd allow the API to return null values as a result, I've shared your usage case and desire for an alternative behaviour with our team.

    We appreciate your understanding!

    ------------------------------
    Carly Rossi // she/her/hers
    Community Program Manager // Jama Software
    Portland, OR
    ------------------------------
    -------------------------------------------
    Original Message:
    Sent: 07-10-2023 10:35
    From: Alex Bruno
    Subject: API GET Item Empty Custom Fields Workaround

    Hello,

    I've been running into an issue with the API not returning fields when using a GET /items/[id] call if the particular field for that particular item is empty. This is incredibly frustrating, as it would seem I cannot set up a robust automated script to be used for that data type without tacking on a bunch of conditionals to check that those fields exist, otherwise it'll randomly throw an error depending on the specific items being reported on.

    After some searching through these forums, it would seem this is known and may even be intended behavior? Reference threads here and here. Neither of those threads note how to work around it or even why this is the behavior. 

    My question is, is there any setting or call or workaround I can use with the GET /items/[id] call that will return all of the fields, regardless of their contents? My only options right now are to validate that every field (or at least the rich text ones) exist in the API response, or to maybe try to pull a list of the fields from GET /itemtypes/{itemTypeId} and somehow stitch it back together? I'd rather avoid those if possible.

    Thank you!!!

    ------------------------------
    Alex Bruno
    Axiom Space
    ------------------------------