# Image Asset Add by API

**URL:** <https://forums.screenly.io/t/image-asset-add-by-api/1204>\
**Category:** Anthias\
**Created:** [October 13, 2023, 2:00pm UTC](https://forums.screenly.io/t/image-asset-add-by-api/1204 "2023-10-13T14:00:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![chita40](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chita40](https://forums.screenly.io/u/chita40)\
**Post date:** [October 13, 2023, 2:00pm UTC](https://forums.screenly.io/t/image-asset-add-by-api/1204/1 "2023-10-13T14:00:46Z")

</div>

Hi,

I am able to add web URL asset using API, but no luck for JPG images files, I am using the following command … not sure where I am missing … i am getting Invalid URL. Failed to add asset.

pi@pi:~/screenly $ curl -s -X POST “[http://192.168.0.192/api/v1.2/assets](http://192.168.0.192/api/v1.2/assets)”   
-H “accept: image/jpeg”   
-H “content-type: application/json”   
-d “{ "mimetype": "image",   
"is\_enabled": 1,   
"name": "my\_first\_file",   
"end\_date": "9999-01-01T00:00:00.000Z",   
"duration": "10",   
"uri": "file//home/pi/jpg.jpg",   
"skip\_asset\_check": 1,   
"start\_date": "2023-10-17T10:37:28.486Z"}”  
{“error”: “Invalid URL. Failed to add asset.”}pi@pi:~/screenly $

Request your help to correct my add asset syntex

Thanks  
Prakash

---

<div class="post-metadata">

**Author:** ![vpetersson](https://yyz1.discourse-cdn.com/flex029/user_avatar/forums.screenly.io/vpetersson/32/8_2.png) [@vpetersson](https://forums.screenly.io/u/vpetersson)\
**Post date:** [October 25, 2023, 3:42pm UTC](https://forums.screenly.io/t/image-asset-add-by-api/1204/2 "2023-10-25T15:42:52Z")

</div>

Yeah that doesn’t look right to me. You’re using `"` inside `"`. See [this post](https://stackoverflow.com/questions/7172784/how-do-i-post-json-data-with-curl) for details.

But in short, you probably want to do something like this:

```bash
curl --header "Content-Type: application/json" \
  --request POST \
  --data '{"mimetype": "image", "is_enabled": 1 [...]}' \
  http://192.168.0.192/api/v1.2/assets

```

---

<div class="post-metadata">

**Author:** ![chita40](https://avatars.discourse-cdn.com/v4/letter/c/35a633/32.png) [@chita40](https://forums.screenly.io/u/chita40)\
**Post date:** [October 27, 2023, 3:32am UTC](https://forums.screenly.io/t/image-asset-add-by-api/1204/3 "2023-10-27T03:32:33Z")

</div>

Thanks @vpetersson for your support !! I have passed the local file via web URL like [http://192.168.0.192/first\_image.jpg](http://192.168.0.192/first_image.jpg)
