'Record Already Exist' Error via Call API Computed Column

Team,

I am making POST requests to an API, and occasionally I receive a response indicating that a ‘record already exists’. However, I am encountering difficulties in querying the JSON response as it is displayed in red text, suggesting it might not be recognised as a valid value. Is there a way to implement a function to check the existence of a record before making a POST request, or to handle this scenario.
Screen Shot 2023-09-24 at 5.50.04 pm

Can you show us a sample output of the API call, and how you’re configuring the “parse_id” column?

Thanks for looking into this. The response is:

{
  "meta": {
    "code": 4003,
    "message": "Tracking already exists.",
    "type": "BadRequest"
  },
  "data": {
    "tracking": {
      "tracking_number": "TRACKING_EXAMPLE",
      "custom_fields": {
        "EXAMPLE": "EXAMPLE"
      },
      "emails": "EMAIL",
      "slug": "SLUG",
      "id": "EXAMPLE_ID",
      "created_at": "2023-09-24T07:54:21+00:00"
    }
  }
}

JSONATA Query:

data.tracking.id

My speculation here is that if the text is not blue, Glide does not compute a valid value(?).

Doesn’t sound like you did anything wrong. Can you refresh the tab and try again?

That’s what I am referring to. The query works if the text is blue and in your case pasted in directly, but the red text is not considering it as a value. I’ve even considered using a template column, but it is returning a blank value.

Does the data section of the JSON actually exist when the error is returned?

1 Like

It likely does not. On a JSON response where the query is not written correctly, it returns a blank value. In this case, it returns a “null”.

Okay, so that explains it then.

What you probably want to do is add another Query JSON column that extracts the Status code (meta.code), and perhaps the message, and then take appropriate action based on the value of that code/message.

With meta.code implemented, the response is as follows. Line 2 should show “429”. However it is returning null.

Screen Shot 2023-09-24 at 6.34.02 pm
Screen Shot 2023-09-24 at 6.35.14 pm

Interesting. Might be a bug. Let me see if I can replicate that.

Update: @RyanRaj - yes, I can replicate this. I think it might be a bug. I’ve reported it.

2 Likes

Awesome, thanks for your help :pray:t3:

Hey @Darren_Murphy is there a ticket or a link where I may be able to follow the reported bug?

No, sorry.
I’ll let you know if/when I get any update.

1 Like