API Tag Library Media

Hey There,

Currently trying to tag some media and cant work out what i am doing wrong with the Curl command.

I know the call would be similar to:

curl -X POST “http://xibo.org.uk/api/library/246/tag” -H “authorization:XXXXXXX” -H “accept: application/json” -H “Content-Type: application/x-www-form-urlencoded” -d “tag=KitchenTV”

but when i input this into the command line i receive a positive response, however the tags are not updated.

{
“mediaId”: 246,
“ownerId”: 2,
“parentId”: 243,
“name”: “filename.png”,
“mediaType”: “image”,
“storedAs”: “246.png”,
“fileName”: “filename.png”,
“tags”: null,
“fileSize”: “95004”,
“duration”: 30,
“valid”: 1,
“moduleSystemFile”: 0,
“expires”: “0”,
“retired”: “0”,
“isEdited”: “0”,
“md5”: “xxxxxx”,
“owner”: “xxxxxx”,
“groupsWithPermissions”: null,
“released”: 1,
“apiRef”: null,
“createdDt”: “2018-06-05 07:38:10”,
“modifiedDt”: “2018-06-05 13:35:33”,
“isSaveRequired”: false,
“isRemote”: null,
“cloned”: false,
“newExpiry”: null,
“alwaysCopy”: false
}

Looking at the API documentation i see the tags need to be in an array aswell. I’ve also tried

curl -X POST “http://xibo.org.uk/api//library/246/tag” -H “authorization:XXXXXXX” -H “accept: application/json” -H “Content-Type: application/x-www-form-urlencoded” -d “tag=array(KitchenTV,test1)”

which doesn’t seem to work.

Have been testing in Curl first until i get it working and then converting it to powershell.

Cheers,

Sam

It’s POST call, as such it does not need to pass application/x-www-form-urlencoded in the header, just the form-data
The call is as follows:

as for curl, the last part should probably be tag[]=KitchenTV,test1 in your example.

Peter,

Thanks so much, all sorted now. Didn’t realise i needed the [] and now all is good!

Now to go down the rabbits hole of getting a new file to upload through to layout/region/playlist/widget :slight_smile:

Regards,
Sam