# Error while inserting new row \[Jun 10\]

**URL:** <https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535>\
**Category:** Discord-Discussions\
**Created:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535 "2022-11-03T10:07:26Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/1 "2022-11-03T10:07:27Z")

</div>

> 🙋‍♂️ **vibrantium** _asked_

## Hello! I’m teaching myself how to insert a new row in the API through Axios. I’m suspecting that I’m formatting the request wrong since it queries for a row instead of inserts. Also all variables are working as I tested these before hands, so that’s why I suspected it’s the way I formatted the request that is wrong. Here’s how it looks so far:

#### 

#### ```js

#### //NocoDB inputting

#### var create = {

#### method: ‘POST’,

#### url: `${sheet_Users}`,

#### headers: {

#### ‘xc-auth’: process.env.nocodb\_token,

#### },

#### fields: {

#### my\_reversals: `${inputtingRev}`,

#### my\_faves: `${inputtingFave}`,

#### random\_or\_faves: `${inputtingRoF}`,

#### created\_on: new Date().toISOString(),

#### },

#### }; // End of create

#### 

#### var inputting

#### var inputtingrequest = await axios

#### .request(create)

#### .then(function (response) {

#### console.log(`This is the response data for inputting new user:`);

#### console.log(response.data);

#### inputting = response.data;

#### UserRow = response.data.ID;

#### })

#### .catch(function (error) {

#### console.error(error);

#### });

#### ```

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/2 "2022-11-03T10:07:28Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### can you help us with the error message?

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/3 "2022-11-03T10:07:29Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### Sure! It’s super long though ☹ but first of all is the “await axios.request(create)” a correct sentence? I’ve seen people use “await axios.post”

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/4 "2022-11-03T10:07:30Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### axios.request(create) is fine. you will have to replace fields with data: {}

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/5 "2022-11-03T10:07:31Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### ```const options2 = {

#### method: ‘POST’,

#### url: ‘[http://localhost:8080/api/v1/db/data/noco/p\_wiukyreqe052rf/Producer/](http://localhost:8080/api/v1/db/data/noco/p_wiukyreqe052rf/Producer/)’,

#### data: { Name: “x1”, Notes: “x1” },

#### headers: {

#### ‘xc-auth’: authToken

#### }

#### };

#### 

#### axios.request(options2).then(function (response) {

#### console.log(response.data);

#### }).catch(function (error) {

#### console.error(error);

#### });```

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/6 "2022-11-03T10:07:32Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### this worked for me.

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/7 "2022-11-03T10:07:33Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### you can find ready sample code (mapped for read api) on clicking get api snippet on your right bottom of grid view window

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/8 "2022-11-03T10:07:35Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### here

 ![image0](https://canada1.discourse-cdn.com/flex011/uploads/nocodb/original/1X/3d1dabd610188ffbfd4d82f721eca4aca1eaeb1d.png)

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/9 "2022-11-03T10:07:36Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### Okay! I tried replacing “fields” to “data” instead & while the error message looks a lot shorter now, here’s what it says:

#### 

#### `TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received an instance of Object`

#### 

#### I did use a variable for the url, it works for when I’m querying/getting a row 🤔

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/10 "2022-11-03T10:07:37Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### try dumping url content to confirm if all good

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/11 "2022-11-03T10:07:38Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### okay just did! pasted the url instead of using the variable where i stored it. still gave me the same TypeError message

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/12 "2022-11-03T10:07:39Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### `${sheet_Users}` : can you dump this? to confirm if its object or a string

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/13 "2022-11-03T10:07:40Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### Wanted to clarify: you “dump” a variable by doing `console.log(variable)` right?

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/14 "2022-11-03T10:07:41Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### yes

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/15 "2022-11-03T10:07:42Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### ah okay good let me share what I got

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/16 "2022-11-03T10:07:43Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### So this is the console log line:

#### ```js

#### console.log(`This is the line right before NocoDB inputting, sheet_Users looks like: ${sheet_Users}`)```

#### 

#### and this is how it looks like in my log:

#### `This is the line right before NocoDB inputting, sheet_Users looks like: http://heyheka.herokuapp.com/api/v1/db/data/noco/p_s828dsukkjkkq4/Heka - User Data/views/Heka - User Data/`

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/17 "2022-11-03T10:07:45Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### there are spaces in name. try url: `${encodeURI(sheet_Users)}`,

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/18 "2022-11-03T10:07:47Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### still gave me the same eror

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/19 "2022-11-03T10:07:48Z")

</div>

> 🙋‍♂️ **vibrantium** _replied_

#### Also I just noticed that one of my fields is a single select field? Do I have to input my data differently or can I just write down my selection name?

#

---

<div class="post-metadata">

**Author:** ![NocoDB](https://avatars.discourse-cdn.com/v4/letter/n/6f9a4e/32.png) [@NocoDB](https://community.nocodb.com/u/NocoDB)\
**Post date:** [November 3, 2022, 10:07am UTC](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535/20 "2022-11-03T10:07:50Z")

</div>

> 👨‍🦲 **dstala** _replied_

#### single select, option in quotes. multi select, comma separated string under quotes (example: “option-1, option-2”)

#

[Next page](https://community.nocodb.com/t/error-while-inserting-new-row-jun-10/535.md?page=2)
