Image Asset Add by API

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
-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

Yeah that doesn’t look right to me. You’re using " inside ". See this post for details.

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

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

Thanks @vpetersson for your support !! I have passed the local file via web URL like http://192.168.0.192/first_image.jpg