Help setting up cURL Command into Shortcuts 'Get Contents of URL'

Hi,

Background:
I have a Sony TV (x900e) and via reddit forums learned about using a cURL Command which enables me to interact with the Sony TV via Terminal on my Mac. Specifically Powering ON/OFF the TV.

Goal:
I have not been successful myself at taking the cURL Command I have working via Terminal on my Mac and getting it to work on the New Apple Shortcuts app.I am not even sure if it is currently possible to do this on the Shortcuts app but was hoping someone on this forum may know.

I would love some assistance at taking the attached cURL Command and successfully set it up in the Apple Shortcuts app likely using the ‘Get Contents of URL’ component to run the command.

I am not opposed to using other iOS apps to help run the cURL Command but I am looking specifically to be able to begin running it via the Shortcuts app.

curl -v -XPOST`   `http://``[your_IP]``/sony/IRCC`   `-d '<?xml version="1.0"?><s:Envelope xmlns:s="``http://schemas.xmlsoap.org/soap/envelope/``" s:encodingStyle="``http://schemas.xmlsoap.org/soap/encoding/``"><s:Body><u:X_SendIRCC xmlns:u="urn:schemas-sony-com:service:IRCC:1"><IRCCCode>AAAAAgAAABoAAAB8Aw==</IRCCCode></u:X_SendIRCC></s:Body></s:Envelope>' -H 'Content-Type: text/xml; charset=UTF-8' -H 'SOAPACTION: "urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"' -H 'X-Auth-PSK: [your_PSK]'

to

See if you can make this work.
Basic idea is to setup all -H into Headers, the -d into Request Body.

1 Like

@supermamon

Thank you for your reply! Hopefully when possible you can help me a little more.

I was able to run your Shortcut and place in my IP and PSK but unfortunately it did not work. I tried playing around with it a little as well but still did not work.

I do not know if the output information would be helpful for you or anyone else to diagnose but I have attached it in the case it does or gives you additional ideas of what I can try.

Again,

Thank you.

It is saying you have sent it an invalid action.

I’m guessing that’s the IRCCCode … but it could be that the SOAPACTION payload is incorrectly formatted if that code is working from a desktop CURL.

1 Like

Can you try to enclose the value of SOAPACTION with double-quotes?

"urn:schemas-sony-com:service:IRCC:1#X_SendIRCC"

1 Like

Thanks @supermamon

I gave that a try but still resulted in same output as I posted above.

@sylumer here is the cURL Command on my Mac Terminal that was successful. I thought I’d post in in the case it helps you, @supermamon or anyone else get any additional ideas or tweaks to try.

Really appreciate all help so far and to come.

Quick question. The -d parameter in your curl. Should that be included in your shortcut’s POST, if so where is it?

Additional information I realized doesn’t show up in any of my previous screenshots.

Just wanted to have it easily viewable as to what the Text File @supermamon original used in the Shortcut he built displays.

Original cURL Command run on my Mac which runs correctly and Powers ON/OFF my Sony TV.

Shortcut @supermamon created based off above cURL Command and the output I am currently receiving.

@sylumer I believe so but I am not entirely sure if the -d parameter in my cURL is in the Shortcut’s POST. Hopefully the additional screenshots I have attached clarify if so.

Maybe this could be of use/helpfulness to one of you with more understanding or knowledge than me.

or

This last posting indcates you can send with an HTTP API using JSON and provides a nice brief looking string. I’d suggest that you try that.

Based on what you linked to I’d start with something maybe like this (amended with the appropriate details for your set-up):

https://www.icloud.com/shortcuts/7035311a34cf40a29109a7136d574187

Note also that if you duplicate your shortcut and amend your key, you could safely share your actual shortcut here. It would save a lot of screenshots and missing data because it is effectively truncated on the screenshot.

Hope that helps.

1 Like

@sylumer thank you very much for the reply. I am going to give the Shortcut you supplied a go once I am home and report back.

Also, you are definitely right, I should add the a link to the screenshots to the actual Shortcut itself, totally forgot that. I do like to supply screenshots in addition though as some people wont open the Shortcut itself.

Again, thank you!