# Error with curl

**URL:** <https://community.influxdata.com/t/error-with-curl/10097>\
**Category:** Store\
**Created:** [June 12, 2019, 3:41am UTC](https://community.influxdata.com/t/error-with-curl/10097 "2019-06-12T03:41:06Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sol\_Invictus](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sol_invictus/32/3153_2.png) [@Sol\_Invictus](https://community.influxdata.com/u/Sol_Invictus)\
**Post date:** [June 12, 2019, 3:41am UTC](https://community.influxdata.com/t/error-with-curl/10097/1 "2019-06-12T03:41:06Z")

</div>

Hey I am pretty new to InfluxDb and I have some trouble when creating a databas via curl in the Influx Shell.

Can somebody help?

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [June 12, 2019, 6:54am UTC](https://community.influxdata.com/t/error-with-curl/10097/2 "2019-06-12T06:54:19Z")

</div>

Hi @Sol_Invictus, Welcome !

Curl is not used within the influx shell ,  
Here is a curl example to create a database [Create database](https://docs.influxdata.com/influxdb/v1.7/guides/writing_data/)

Hope this helps …

Ps you can also create a database with the influx commandline

---

<div class="post-metadata">

**Author:** ![Sol\_Invictus](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sol_invictus/32/3153_2.png) [@Sol\_Invictus](https://community.influxdata.com/u/Sol_Invictus)\
**Post date:** [June 12, 2019, 7:12am UTC](https://community.influxdata.com/t/error-with-curl/10097/3 "2019-06-12T07:12:13Z")

</div>

Hey Marc thanks for your answer!

I need the curl command because I want ro write Data Points from a file into Influx.

Is the Http API something different than the Influx Shell? How can I acess it?

Thank you

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [June 12, 2019, 7:59am UTC](https://community.influxdata.com/t/error-with-curl/10097/4 "2019-06-12T07:59:44Z")

</div>

Hi ,

to create a database with curl , you can start curl from the command prompt :

curl -i -XPOST [http://localhost:8086/query](http://localhost:8086/query) --data-urlencode “q=CREATE DATABASE mydbfromcurl”

and to go to the influx shell (cli ) you can type influx to enter the shell  
and type your commands in the shell ,

or for example : influx -execute “show databases”

you can write datapoints from a file to the database as follows :

curl -i -XPOST ‘[http://localhost:8086/write?db=Mydb](http://localhost:8086/write?db=Mydb)’ --data-binary @cpu\_data.txt

but it is better explained in the link I posted 🙂

---

<div class="post-metadata">

**Author:** ![Sol\_Invictus](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sol_invictus/32/3153_2.png) [@Sol\_Invictus](https://community.influxdata.com/u/Sol_Invictus)\
**Post date:** [June 12, 2019, 2:15pm UTC](https://community.influxdata.com/t/error-with-curl/10097/5 "2019-06-12T14:15:06Z")

</div>

Hi Mark,

Thanks for your Help! I figured it out.  
Now I am trying to curl this sample dataset into Influx, but it doesnt recognise the dataset.

Here is the dataset: [GitHub - influxdata/influxdb-sample-data: Sample time series data used to test InfluxDB](https://github.com/influxdata/influxdb-sample-data)  
Thanks again for your help.

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [June 12, 2019, 3:17pm UTC](https://community.influxdata.com/t/error-with-curl/10097/6 "2019-06-12T15:17:47Z")

</div>

Hi ,

that dataset is 4 years old and contains json formatted data 🙂 ,  
do you want to upload json formatted data ?

> ### [Writing points from a file](https://docs.influxdata.com/influxdb/v1.7/guides/writing_data/#writing-points-from-a-file)
> 
> Write points from a file by passing `@filename` to `curl` . The data in the file should follow InfluxDB’s [line protocol syntax](https://docs.influxdata.com/influxdb/v1.7/write_protocols/write_syntax/).
> 
> Example of a properly-formatted file ( `cpu_data.txt` ):
> 
> ```auto
> cpu_load_short,host=server02 value=0.67
> cpu_load_short,host=server02,region=us-west value=0.55 1422568543702900257
> cpu_load_short,direction=in,host=server01,region=us-west value=2.0 1422568543702900257
> 
> ```
> 
> Write the data in `cpu_data.txt` to the `mydb` database with:  
> `curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary @cpu_data.txt`

> **[Write data with the InfluxDB API | InfluxDB OSS v1 Documentation](https://docs.influxdata.com/influxdb/v1/guides/writing_data/)**
>
> Use the command line interface (CLI) to write data into InfluxDB with the API.

---

<div class="post-metadata">

**Author:** ![Sol\_Invictus](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sol_invictus/32/3153_2.png) [@Sol\_Invictus](https://community.influxdata.com/u/Sol_Invictus)\
**Post date:** [June 12, 2019, 3:30pm UTC](https://community.influxdata.com/t/error-with-curl/10097/7 "2019-06-12T15:30:03Z")

</div>

Hey

Actually its not important.  
I just want to write a big dataset into influx.  
Do you maybe have a better dataset I can write into Influx?

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [June 12, 2019, 4:09pm UTC](https://community.influxdata.com/t/error-with-curl/10097/8 "2019-06-12T16:09:55Z")

</div>

sure here it is 🙂 … [sample data](https://docs.influxdata.com/influxdb/v1.7/query_language/data_download/)

---

<div class="post-metadata">

**Author:** ![Sol\_Invictus](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sol_invictus/32/3153_2.png) [@Sol\_Invictus](https://community.influxdata.com/u/Sol_Invictus)\
**Post date:** [June 12, 2019, 6:47pm UTC](https://community.influxdata.com/t/error-with-curl/10097/9 "2019-06-12T18:47:45Z")

</div>

How can I Download the Data there ?  
I just see graphs when I click on a station in a state.

---

<div class="post-metadata">

**Author:** ![MarcV](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/marcv/32/7676_2.png) [@MarcV](https://community.influxdata.com/u/MarcV)\
**Post date:** [June 12, 2019, 8:28pm UTC](https://community.influxdata.com/t/error-with-curl/10097/10 "2019-06-12T20:28:35Z")

</div>

Hi , yes ,

The data is here :

[https://s3.amazonaws.com/noaa.water-database/NOAA\_data.txt](https://s3.amazonaws.com/noaa.water-database/NOAA_data.txt)

---

<div class="post-metadata">

**Author:** ![Sol\_Invictus](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/sol_invictus/32/3153_2.png) [@Sol\_Invictus](https://community.influxdata.com/u/Sol_Invictus)\
**Post date:** [June 12, 2019, 8:39pm UTC](https://community.influxdata.com/t/error-with-curl/10097/11 "2019-06-12T20:39:22Z")

</div>

Hey thanks got it.

Now I am follwing the instructions on this site:

> **[Sample data | InfluxDB OSS 1.7 Documentation](https://docs.influxdata.com/influxdb/v1.7/query_language/data_download/)**
>
> In order to explore the query language further, these instructions help you create a database, download and write data to that database within your InfluxDB installation. The sample data is then used and referenced in Data Exploration, Schema...

And I get a error message when I use the command:

```auto
influx -import -path=NOAA_data.txt -precision=s -database=mydb

```

It says that it expects something like “CREATE” or “SHOW” after the Influx command.  
Do you know what the Problem could be?
