¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

REST API for Crestron Virtual Control #simplsharppro


 
Edited

G'day all,

Has anyone successfully added or modified a program file on a VC4 using curl and the REST API from a command line?
I've tried but have been unable to make it work.

I can query the existing programs using the following;
curl -k -X GET "http://10.0.0.222/VirtualControl/config/api/ProgramLibrary" -H "accept: application/json" -H "Authorization: [#####]"

I can't work out how to send the program file. When I try to send the following;
curl -k -X PUT "http://10.0.0.222/VirtualControl/config/api/ProgramLibrary" -d {"ProgramId":23,"AppFile":"D:\CrestronCode\Code\bin\Debug\test.cpz"} -H "accept: application/json" -H "Authorization: [#####]"

I receive the following message.
{
"Actions": [
{
"Operation": "set partial",
"Results": [
{
"path": "Device.Programs.ProgramLibrary",
"object": "NULL",
"StatusInfo": "ProgramId: Missing required parameter in the JSON body or the post body or the query string",
"StatusId": 6
}
],
"TargetObject": "ProgramLibrary",
"Version": "2.0.1"
}
]
}
?
Thanks in advance.


 

The example shown in the API docs is a POST request with multipart form data, so I would start with that:?

I don't see an example of actually uploading a file though, just pointing to an existing one.

On Mon, Oct 17, 2022 at 1:00 AM <matthew.taylor@...> wrote:

[Edited Message Follows]

G'day all,

Has anyone successfully added or modified a program file on a VC4?
I've tried but have been unable to make it work.

I can query the existing programs using the following;
curl -k -X GET "" -H "accept: application/json" -H "Authorization: [#####]"

I can't work out how to send the program file. When I try to send the following;
curl -k -X PUT "" -d {"ProgramId":23,"AppFile":"D:\CrestronCode\Code\bin\Debug\test.cpz"} -H "accept: application/json" -H "Authorization: [#####]"

I receive the following message.
{
"Actions": [
{
"Operation": "set partial",
"Results": [
{
"path": "Device.Programs.ProgramLibrary",
"object": "NULL",
"StatusInfo": "ProgramId: Missing required parameter in the JSON body or the post body or the query string",
"StatusId": 6
}
],
"TargetObject": "ProgramLibrary",
"Version": "2.0.1"
}
]
}
?
Thanks in advance.


 

Thanks for the reply Jeremy.
The example with the POST request is using the "Add Program" command.
I'm wanting to use the "Modify Program" command to modify an existing program. This is listed as a PUT request.
Unfortunately I'm still unable to make this work.


 
Edited

I have this working inPowerShell with the following for anyone who's interested.

$file = "D:\file\path\VTProFile.cpz"
$ip = "10.0.0.222"
$ProgramId = 23
$Token = "#####"
$Authorization = "Authorization: $Token"
?
curl.exe -X PUT -H $Authorization -F StartNow=true -F AppFile=@$file -F ProgramId=$ProgramId

Mush