# Write data with the influxdb API

**URL:** <https://community.influxdata.com/t/write-data-with-the-influxdb-api/24940>\
**Category:** InfluxDB 2\
**Tags:** influxdb, influxdata, influxql\
**Created:** [May 7, 2022, 4:27pm UTC](https://community.influxdata.com/t/write-data-with-the-influxdb-api/24940 "2022-05-07T16:27:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hieu\_Nguyen](https://avatars.discourse-cdn.com/v4/letter/h/22d042/32.png) [@Hieu\_Nguyen](https://community.influxdata.com/u/Hieu_Nguyen)\
**Post date:** [May 7, 2022, 4:27pm UTC](https://community.influxdata.com/t/write-data-with-the-influxdb-api/24940/1 "2022-05-07T16:27:22Z")

</div>

Hi everyone,

I want to use the API to write data, and I refer to reading documents for the syntax line protocol as the following:

```auto
<measurement>[,<tag_key>=<tag_value>[,<tag_key>=<tag_value>]] <field_key>=<field_value>[,<field_key>=<field_value>] [<timestamp>]

```

this format data works fine

```auto
testing,enable=true,id_project=1 last=23

```

But if I replace the field\_key with strings, then I get the following error:

```auto
testing,enable=true,id_project=1 last="this is a test"

HTTP/1.1 500 Internal Server Error
Content-Type: 
Request-Id: 
X-Influxdb-Build: ENT
X-Influxdb-Error: write failed: partial write: field type conflict: input field "last" on measurement "push_mirror" is type string, already exists as type float dropped=1
X-Influxdb-Version: 1.9.3-c1.9.3
X-Request-Id: 
Date: Sat, 07 May 2022 16:18:24 GMT
Content-Length: 169

{"error":"write failed: partial write: field type conflict: input field \"last\" on measurement \"push_mirror\" is type string, already exists as type float dropped=1"}

```

where am I going wrong with syntax?  
Thanks in advance!

---

<div class="post-metadata">

**Author:** ![yosiasz](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/yosiasz/32/8060_2.png) [@yosiasz](https://community.influxdata.com/u/yosiasz)\
**Post date:** [May 7, 2022, 4:54pm UTC](https://community.influxdata.com/t/write-data-with-the-influxdb-api/24940/2 "2022-05-07T16:54:18Z")

</div>

Sounds like data type definition. What is data type for last defined as?

---

<div class="post-metadata">

**Author:** ![Hieu\_Nguyen](https://avatars.discourse-cdn.com/v4/letter/h/22d042/32.png) [@Hieu\_Nguyen](https://community.influxdata.com/u/Hieu_Nguyen)\
**Post date:** [May 8, 2022, 3:40am UTC](https://community.influxdata.com/t/write-data-with-the-influxdb-api/24940/3 "2022-05-08T03:40:16Z")

</div>

I found the issue, as @yosiasz said that this is an issue about data type definition when I defined and stored the field value as an interger first, so that’s reason I got an error above.

Thanks for your comment which leads me to that thought.
