Getting started with Sony Audio Control API

1.4k Views Asked by At

Trying to use the new Sony Audio Control API with my STR-DN1080 (firmware M41.R.0377), but having a lot of trouble following the guide on https://developer.sony.com/develop/audio-control-api/. It's certainly pretty looking, but the Tutorials are not very helpful.

So based on that portal, it sounds like I need to discover the receiver's port via SSDP/UPNP. There's not much guidance on how to do this, so I used an Android app "UPNP Browser" and found 3 separate URLs. Within http://str.dn.1080.ip:52323/dmr.xml, I find the base URL:port and available services:

<av:X_ScalarWebAPI_DeviceInfo>
<av:X_ScalarWebAPI_Version>1.0</av:X_ScalarWebAPI_Version>
<av:X_ScalarWebAPI_BaseURL>http://str.dn.1080.ip:10000/sony</av:X_ScalarWebAPI_BaseURL>
<av:X_ScalarWebAPI_ServiceList>
<av:X_ScalarWebAPI_ServiceType>guide</av:X_ScalarWebAPI_ServiceType>
<av:X_ScalarWebAPI_ServiceType>system</av:X_ScalarWebAPI_ServiceType>
<av:X_ScalarWebAPI_ServiceType>audio</av:X_ScalarWebAPI_ServiceType>
<av:X_ScalarWebAPI_ServiceType>avContent</av:X_ScalarWebAPI_ServiceType>
</av:X_ScalarWebAPI_ServiceList>
</av:X_ScalarWebAPI_DeviceInfo>

Then, following the API reference for getSystemInformation (v1.4), I issue a GET to http://str.dn.1080.ip:10000/sony/system/getSystemInformation, but all I get back is {"error":[404,"Not Found"]}

I'm stumped now, and looking for help from Sony Developer Support. What am I missing? Is there something I need to enable on my receiver? Is there a hidden firmware that the Auto Updater won't apply?

Thanks!

2

There are 2 best solutions below

1
On BEST ANSWER

The Sony Audio Control API is based on POST request. So you have to use some program that can generate a POST request like curl to send requests

curl -i -d '{"method": "getSystemInformation","id": 1,"params": [],"version": "1.4"}' http://str.dn.1080.ip:10000/sony/system

You can also use programs like postman to send test requests if you want something with a GUI.

0
On

For those searching on how to use the Sony API in Windows with curl, and to add onto the accepted answer, you'll need to replace the single quotes with double quotes and then escape the double quotes in the JSON:

curl -i -d "{\"method\": \"getSystemInformation\",\"id\": 1,\"params\": 
[],\"version\": \"1.4\"}" http://str.dn.1080.ip:10000/sony/system

For postman, set type to POST, URL to: http://str.dn.1080.ip:10000/sony/system, and specify Body as raw/JSON, and paste the JSON:

{
   "method":"getSystemInformation",
   "id":1,
   "params":[],
   "version":"1.4"
}