API workflow help

Having a little issue with a API workflow I have setup.

In my database I have a table called “Search History” with a “Content ID” and “Score” field.

The webhook response I receive to my API has a “Scan ID” and “aggregatedScore”
I am looking to update my “Score” field with the API’s “aggregatedScore” when the “Scan ID” matches the “Content ID”.

This is what I have currently, what am I missing?

api

Hi there, @ashley.russell77… I assume the search has a constraint on it where the search history’s content ID is the request data’s body score scan ID, and I guess you are saying you know you have a record that should be getting updated but isn’t, right? If that is the case, one thing that comes to mind is privacy rules. Do you have any privacy rules in place on the Search History data type, and have you tried setting the workflow to ignore privacy rules when it is run?

Best…
Mike

1 Like

Hi Mike, thank you for the reply.

The above is correct.

The search history is public and I have my workflow set to ignore privacy rules.

Anything useful in the server logs?

1 Like

My dumb ass just tried to zoom in on that workflow… in an image. Nice work, Mike.

I guess it found the right thing to make changes to? I assume the score is supposed to be something other than 0?

1 Like

It is possible for the score to be 0, do you think that might be the problem?

I will try push a result over that gives a score other than zero to see if it makes a difference.

Same results even when I had a score of 100 returned. Here you can see the server log and the database with the 2 previous requests and the score not updated:


This is part of the webhook response I received:

{
  "scannedDocument": {
    "scanId": "5no3k5c0f7mw5287sjyt",
    "totalWords": 30,
    "totalExcluded": 0,
    "credits": 1,
    "expectedCredits": 1,
    "creationTime": "2022-12-31T20:26:56.743023Z",
    "metadata": {
      "filename": "5no3k5c0f7mw5287sjyt.txt"
    }
  },
  "results": {
    "score": {
      "identicalWords": 30,
      "minorChangedWords": 0,
      "relatedMeaningWords": 0,
      "aggregatedScore": 100.0
    },

But the log is showing that the score is getting updated, right? Sorry for the stupid question, but I’m guessing you refreshed the data on the app data tab, yes? I only ask because that trips me up sometimes.

1 Like

I refreshed yeah. I just scrolled through and noticed that my first entry in the table has a score of 100, so I presume that the workflow is just finding the first entry in the table and updating that instead of updating the entry that matches the content ID and Scan ID.

I will run another test to get a different score to see if it is only updating the first entry.

Yeah it’s actually just updating the first entry.

I already asked if the search has the proper constraint on it, and you confirmed that it does, so it’s weird that it would be making changes to the wrong thing.

1 Like

Sorry maybe I misunderstood., I’m a little confused.

In the screenshot in your initial post in this thread, click on Search for search historys. Is there a constraint on the search that says something like Content ID = Request Data’s body score Scan ID?

1 Like

Dam no sorry :frowning:

That was the issue. My bad, sorry for wasting your time.

No worries at all… stuff like that happens… glad we got it sorted out.

1 Like