Failing to configure PUT API

Options

The API should update a variable DAYS which is an array of integers. But when I enter a test value like [2,3,13] - it fails to update with a right array. Instead I'm getting zeros.

Yet, a very similar POST API works fine, and accepts an array of integers.

What could be a reason?

Answers

  • arturosanz
    arturosanz Member ✭✭
    Options

    I've tried to add and edit records with an integer[] field with POST, PUT, and PATCH and they all worked well. There must be something else in your function stack that resets the days array to 0's somehow.

    The first screenshot executed 5 statements while the second one executed 7. Probably the function stacks aren't the same.

  • Lefteris - blupry.com
    Options

    Hey @Denis Vasiliev,

    I am guessing you are using "Edit Record" as you should for a specific record.

    In this case since you are trying to replace the days object on that specific record, you should use PUT and not PATCH (as you do on the screenshot).

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Options

    Recording a short loom video gives you a chance to show off all the function stacks and the database setup as well as run a couple of tests. The video gives others a chance to freeze frame and is a great way to share a lot more information without having to do a lot of work.

  • Denis Vasiliev
    Options

    Dear all, thanks for your responses!

    The issue is RESOLVED

    I've tried everything: changed to PUT, re-created the same API from scratch - nothing helped. Then I noticed that if I provide a hard-defined input variable instead of using Database Link, it worked. Eventually, I've ended up deleting and recreating the DB column in question DAYS and it worked. Luckily, it's still a test mode with no user data.

    A glitch?

    PS. Great advice with Loom recordings

    PS2. I've kept the "broken" API in case Xano engineers wanna have a look