Win10 API curl syntax help

Sonarr: 3.0.0.499
OS: Windows 10 x64

I’m using IFTTT webhooks to run Wake on Lan (based on my TV calendar) i.e. if there’s a new episode aired then my PC will turn on and download the any missing episode.

The part I’m stuck at is, I need to get Sonarr to perform a search for missing episodes once the PC has turned on. So naturally I read the documentation for the API https://github.com/Sonarr/Sonarr/wiki/API. Unfortunately there’s not an example of the command syntax for Windows, just linux. I don’t want to use PowerShell at the moment, but can If I cannot utilise curl.

As Windows 10 has integrated curl support, I can just run a scheduled task to run the curl command on resume.

Where I’m falling short is with the syntax for the curl command on windows command line.

As I understand it. My syntax needs to be
curl -d '{name: "missingEpisodeSearch"}' -H "Content-Type: application/json" -X POST http://localhost:38082/sonarr/api/command?apikey=API

I’m using a reverse proxy so I include the /sonarr

Sonarr log says:

Newtonsoft.Json.JsonReaderException: Unterminated string. Expected delimiter: '. Path '', line 1, position 7.
   at NzbDrone.Common.Serializer.Json.Deserialize(String json, Type type) in M:\BuildAgent\work\63739567f01dbcc2\src\NzbDrone.Common\Serializer\Json.cs:line 59
   at Sonarr.Http.Extensions.ReqResExtensions.FromJson(Stream body, Type type) in M:\BuildAgent\work\63739567f01dbcc2\src\Sonarr.Http\Extensions\ReqResExtensions.cs:line 31
   at Sonarr.Http.Extensions.ReqResExtensions.FromJson[T](Stream body, Type type) in M:\BuildAgent\work\63739567f01dbcc2\src\Sonarr.Http\Extensions\ReqResExtensions.cs:line 24
   at Sonarr.Http.Extensions.ReqResExtensions.FromJson[T](Stream body) in M:\BuildAgent\work\63739567f01dbcc2\src\Sonarr.Http\Extensions\ReqResExtensions.cs:line 19
   at Sonarr.Http.REST.RestModule`1.ReadResourceFromRequest(Boolean skipValidate) in M:\BuildAgent\work\63739567f01dbcc2\src\Sonarr.Http\REST\RestModule.cs:line 198
   at Sonarr.Http.REST.RestModule`1.<set_CreateResource>b__42_0(Object options) in M:\BuildAgent\work\63739567f01dbcc2\src\Sonarr.Http\REST\RestModule.cs:line 165
   at CallSite.Target(Closure , CallSite , Func`2 , Object )
   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)

Windows CMD says:

C:\Users\mikep>curl -d '{name: "missingEpisodeSearch"}' -H "Content-Type: application/json" -X POST http://localhost:38082/sonarr/api/command?apikey=API
curl: (3) [globbing] unmatched close brace/bracket in column 21
{
  "message": "Unterminated string. Expected delimiter: '. Path '', line 1, position 7.",
  "description": "Newtonsoft.Json.JsonReaderException: Unterminated string. Expected delimiter: '. Path '', line 1, position 7.\r\n   at NzbDrone.Common.Serializer.Json.Deserialize(String json, Type type) in M:\\BuildAgent\\work\\63739567f01dbcc2\\src\\NzbDrone.Common\\Serializer\\Json.cs:line 59\r\n   at Sonarr.Http.Extensions.ReqResExtensions.FromJson(Stream body, Type type) in M:\\BuildAgent\\work\\63739567f01dbcc2\\src\\Sonarr.Http\\Extensions\\ReqResExtensions.cs:line 31\r\n   at Sonarr.Http.Extensions.ReqResExtensions.FromJson[T](Stream body, Type type) in M:\\BuildAgent\\work\\63739567f01dbcc2\\src\\Sonarr.Http\\Extensions\\ReqResExtensions.cs:line 24\r\n   at Sonarr.Http.Extensions.ReqResExtensions.FromJson[T](Stream body) in M:\\BuildAgent\\work\\63739567f01dbcc2\\src\\Sonarr.Http\\Extensions\\ReqResExtensions.cs:line 19\r\n   at Sonarr.Http.REST.RestModule`1.ReadResourceFromRequest(Boolean skipValidate) in M:\\BuildAgent\\work\\63739567f01dbcc2\\src\\Sonarr.Http\\REST\\RestModule.cs:line 198\r\n   at Sonarr.Http.REST.RestModule`1.<set_CreateResource>b__42_0(Object options) in M:\\BuildAgent\\work\\63739567f01dbcc2\\src\\Sonarr.Http\\REST\\RestModule.cs:line 165\r\n   at CallSite.Target(Closure , CallSite , Func`2 , Object )\r\n   at Nancy.Routing.Route.<>c__DisplayClass4.<Wrap>b__3(Object parameters, CancellationToken context)"
}

Thanks in advanced.

Try
curl -d "{name: \"missingEpisodeSearch\"}" -H "Content-Type: application/json" -X POST http://localhost:38082/sonarr/api/command?apikey=API

@Snuser Thank you Sir! that’s what I needed :smiley:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.