Add Object Record
Hi,
I want to add a new record using API. I have an object field called "Layanan" and inside it has an enum list with 3 values which are "BI-RTGS", "BI-Fast", and "Lalu lintas Giro". I tried to do it, but it returns the following error message. How should I do it?
Answers
-
I would first debug the api response itself and see if the parameter Layanan is 100% there. The other thing is to use "get" filter instead of dot notation, which allows you to assign a default value even if certain path is missing.
But first and foremost I would start with you layanan object and check it step by step. I would be able to tell more if you can share the screenshot of the API response itself.
-
Hi @Pawel Magdanski,
I debugged the transaction table using GET /transaction API (to query all record) and the "layanan" parameter is there (see image below)
I also change the path in POST /transaction API (to add a new record), however, I don't know if the path I defined is correct (see image 2 below)
I attempted to add a new record with this script :
{
"user_id": 1,
"no_rekening": 123456,
"nominal": 50000,
"berita": null,
"layanan": [ 2 ],
"status": "allowed"
}
and the API response is still like this :
I thought that perhaps I write the scripts wrong, but I don't know how should I write it right
-
So first thing that I can see is that layanan is an input, I would first put it into variable. Second thing your path is transaction.layanan which does not seems right looking at the screenshot of the object you provided
Try something like layanan.0 → get → Layanan → first -
Okey, I tried to do this, but I still got the same error message. Could you please give me more instruction? @Pawel Magdanski
-
Hi,
Well, first thing I can see is that your first layanan is a text, not a variable. Secondly your second layanan is not starting with capital letter.
You need to be precise with those things, and the mistake of putting text instead of variable into field is one of the most common ones.
Categories
- All Categories
- 53 ? Announcements
- 47 ? Releases
- 37 ? Welcome
- 983 ? Help! I'm a Noob
- 125 ? No-Code Front-Ends
- 633 ? Working with APIs
- 439 ? Transforming data
- 126 ? Connect Xano to ...
- 50 ?? Find an Expert
- 348 ❓Other questions
- 35 ? Security
- 22 ✂️ Snippets
- 19 ? Showcase
- 7 ?️ Xano Chatter
- 62 ? Video Tutorials
- 171 ? Request a feature
- 229 ? Report a Bug
- 19 ? Templates & Extensions
- 7 ? Feedback