Insufficient Error Response on Create Points Transaction REST Endpoint

My Source Material: Create Point Transaction Point Transaction REST Endpoint - API Documentation - Verint Community 11.x - Verint | Telligent Community

What I'm trying to do:

Create a mechanism to handle points assignments based around a document or list.

What I've got working:

I've written a few PowerShell functions that'll handle this processing in bulk which works 99% (the 1% described below).  Only the functions are posted in my GitHub.  The process is:

  1. Open CSV.
  2. Find Username, Description, Points to be Awarded, and (optional) the Date for the assignment.
  3. Search for each user in the community via Username (GET)
  4. Capture their User ID, their ContentID, and their ContentTypeID.
  5. Build a body to send to the Create Points endpoint via POST.
  6. Execute the POST and capture the point transaction Id and transaction time.
  7. Store them back into the CSV file.

This works correctly with a minor exception.  The Create Point transaction doesn't seem to honor the "CreatedDate" field.

What's not working:

I'm trying to do this 'better' by doing it in SharePoint and using a list with Power Automate.

It's working correctly for pulling the user's id, ContentType, and ContentTypeID.

I build the JSON body for the POST to Create Point Transaction (and I'm also saving a copy to a file share for good measure). 

{
    "Description": "<p>Completion of Automated Points Awarding Process [427 Points]</p>",
    "UserId": "2109",
    "Value": "427",
    "ContentId": "e936538a-891a-451a-9982-037099b9dbf4",
    "ContentTypeId": "e9ed4118-60ed-4f2b-a026-5705b8793d05",
    "CreatedDate": "2021-03-08T00:00:00"
}

Note: The actual JSON is linearized, the above is formatted for easier reading.

I make the call with the appropriate headers, but get the error I get returned is:

{
  "": null,
  "Errors": [
    "Description is required"
  ]
}

I know for a fact that "Description" is defined, so there's another error, but something else is off.  I recall seeing a similar message when I wrote the PowerShell scripts - which was also wrong.

What I've tried to no avail: removing the quotes from around the integer elements (UserId, Value).

I'd appreciate any assistance I can get on this!

Parents
  • Former Member
    0 Former Member

    in your func_points.ps1 does your $Body object need to be converted to JSON?

    $Body = @{
        Description = "<p>$Description</p>";
        UserId = $UserId;
        Value = $Points;
        ContentID = $ContentId;
        ContentTypeId = $ContentTypeId;
        CreatedDate = $AwardDateTime;
    }
    try {
        $PointsRequest = Invoke-RestMethod -Uri ( $CommunityDomain + $Uri ) -Method Post -Body $Body -Headers $AuthHeader
        $PointsRequest.PointTransaction
        }
        catch {
        Write-Error -Message "Something didn't work"
    }

  • No, it does not.  The Invoke-RestMethod function automatically converts the hash table into the proper JSON format.  It's designed that way intentionally to eliminate/reduce complexity.

    The PowerShell stuff works perfectly though I do want to change the Get-vtAuthHeader function.  Right now, it only has a "read/write" option for the 'PUT' Rest-Method, but I need to extend it to handle the additional methods I've since discovered ('DELETE').

  • Former Member
    0 Former Member in reply to KMSigma

    I was looking at the formatting of the JSON because of the error.  Once our code sees no Description, it just returns that error and stops processing.  That is why I was looking at how the request was formatted.

Reply Children