# Upload through API

**URL:** https://discourse.libretime.org/t/upload-through-api/446
**Category:** Get Help
**Created:** [January 15, 2020, 8:51pm UTC](https://discourse.libretime.org/t/upload-through-api/446 "2020-01-15T20:51:12Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![cderuiter](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/cderuiter/32/725_2.png) [@cderuiter](https://discourse.libretime.org/u/cderuiter)
#### Post date: [January 15, 2020, 8:51pm UTC](https://discourse.libretime.org/t/upload-through-api/446/1 "2020-01-15T20:51:12Z")

</div>

Libretime friends,  
We have a contributor who makes available a weekly program for download.  
This file is downloaded and the ID3v2 info is manipulated by a cron script.  
The only thing left to do is to automatically import this into the Libretime audio carts.  
Does anybody knows if we can use the API with a CURL PUT command as in ;  
$ curl -F ‘img\_avatar=@/home/petehouston/hello.txt’ [http://localhost/upload](http://localhost/upload)  
but than of course with the use of the API.

any thoughts ???

---

<div class="post-metadata">

### Author: ![robbt](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/robbt/32/15_2.png) [@robbt](https://discourse.libretime.org/u/robbt)
#### Post date: [January 16, 2020, 2:03pm UTC](https://discourse.libretime.org/t/upload-through-api/446/2 "2020-01-16T14:03:20Z")

</div>

I would look into how airtime\_analyzer works, there is some stuff done with the REST API, but unfortunately at the moment we are still relying upon an ad-hoc API vs. something that we have actually defined explicitly so it could change.

With regards to how to import it, an RSS feed is probably the easiest format but this might be overkill for what your contributor wants to do.

So yeah there is no easy way to do this right now, the filesystem import stuff that is currently in various PRs might work along with a cron job but otherwise you will need to investigate it and see what you can figure out.

---

<div class="post-metadata">

### Author: ![cderuiter](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.libretime.org/cderuiter/32/725_2.png) [@cderuiter](https://discourse.libretime.org/u/cderuiter)
#### Post date: [September 6, 2024, 4:33pm UTC](https://discourse.libretime.org/t/upload-through-api/446/3 "2024-09-06T16:33:55Z")

</div>

I see that I’ve never provided the answer for this question, for this my sincere apologies.

As I have this running inside docker the answer on how to upload a file is:

docker exec libretime-postgres psql -U libretime -c “UPDATE CC\_files set mood=‘new’, track\_type\_id=‘9’ WHERE track\_number=$TRACKNR AND composer=‘$Composer’;”

Really straight forward I would say

Or the API and CURL  
curl --max-time 30 http://:8080$IP/rest/media -u $KEY: -X POST -F file=@$UploadDir/$filename -F name=$filename

Chris.
