Skip to content
View in the app

A better way to browse. Learn more.

BuildHub.org.uk

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Curl Syntax

Featured Replies

Jesus! - for the love of God just give me C and an assembler!

 

I'm fighting here! ; simple to someone that knows curl - I'm on windows aswell so I'm even more annoyed than usual!

 

Here's what I'm trying to achieve ....

 

curl -H 'Content-Type: application/json' -X PUT -d '{"configured": true}' http://IP:PORT/api/APIKEY/sensors/ID/config

 

ip:port my HA, APIKEY I got.

 

It's which brackets of which type with which quotes where - that I can't get right. Googling is just adding fuel to the flames.

 

One of you will be some modern sado web page type deal with this mess person ( and much appreciated I will be! )

  • Author
5 minutes ago, jack said:

Get into GPT. Apparently this is exactly the sort of problem it's ideal for solving.

Yeah . Didn’t think of that . Certainly worth a shot !

  • Author
58 minutes ago, jack said:

Get into GPT. Apparently this is exactly the sort of problem it's ideal for solving.

It says it’s correct for a json payload …

  • Author
Just now, pocster said:

It says it’s correct for a json payload …

Better check I’ve got a json payload !

What error are you getting?

 

I think windows isn't a fan of the single quotes on the json - try escaping the inner ones

 

curl -XPUT -H "Content-type: application/json" -d "{\"configured\": true}" http://IP:PORt/api/APIKEY/sensors/ID/config

 

 

  • Author
22 minutes ago, elite said:

What error are you getting?

 

I think windows isn't a fan of the single quotes on the json - try escaping the inner ones

 

curl -XPUT -H "Content-type: application/json" -d "{\"configured\": true}" http://IP:PORt/api/APIKEY/sensors/ID/config

 

 

Mucking windows! > tried as you suggested get rescue/sensors/2, not available, "type 3" error now

  • Author
5 minutes ago, Sparrowhawk said:

Since you're on Windows, can you install Windows Subsystem for Linux (WSL)? It makes tasks like this much easier (I have run out of patience with curl on Windows).

 

Alternatively use Postman (it's free) and run the command there instead of at the command line.

I thought ( after googling ) I had chrome postman add on.  But can't see how I do a CURL in it ; just post/get etc.

2 minutes ago, pocster said:

I thought ( after googling ) I had chrome postman add on.  But can't see how I do a CURL in it ; just post/get etc.

https://www.tutorialspoint.com/how-to-create-a-put-request-in-postman

 

You're replicating the cURL command inside Postman. It's a different syntax but does allow you to save these commands in a playbook to rerun in future.

Edited by Sparrowhawk

3 minutes ago, pocster said:

Mucking windows! > tried as you suggested get rescue/sensors/2, not available, "type 3" error now

Add quotes around the URL?

 

curl -XPUT -H "Content-type: application/json" -d "{\"configured\": true}" "http://IP:PORt/api/APIKEY/sensors/ID/config"
  • Author
Just now, elite said:

Add quotes around the URL?

 

curl -XPUT -H "Content-type: application/json" -d "{\"configured\": true}" "http://IP:PORt/api/APIKEY/sensors/ID/config"

Tried that

2 minutes ago, pocster said:

Tried that

Works for me - things I'd check

 

  1. Weird characters in api key - should've been fixed with quotes
  2. Is the URL / path you're hitting 100% correct?
  3. Try with verbose flag (-v)

What service are you connecting to?

  • Author
7 minutes ago, elite said:

What service are you connecting to?

Do you know . I can’t answer that . I’m following some German advice that I need to connect to a local physical advice to change configured from false to true . It’s insane how convoluted this is - and I’ve still not achieved it .

I do appreciate all the help though !

 

BIT_SET(*(device,).configuration,TRUE);  ( apologies if syntax a little rusty ! )

Are you getting a http status code back -v flag in curl - postman in chrome will prob give you this too? - this might give a clue as to an error (prob 5** range) or not found 4** - Is it definatley device ID 2? This should begiving you a 200 if all is good

 

Happy to cast a second pair of eyes over the german advice if you want to PM

 

  • Author

Trying to import curl command in postman and the error is "2 options less arguments found, only 1 is supported (the URL)"

 

 

  • Author

An extra space believe it or not - which you couldn't 'see' as the curl line was split.

 

Things like this shouldn't exist in 2023. Like on a webpage where you must enter the date and then it complains you need to put spaces in ( no; your code should do that ). Seems to be a common thing with postcode enteries.

Don't get it. Validate the input pad/remove spaces etc. - basic stuff ffs!

 

Anyway! - did my curl and something else is a miss now ( I was told the device id was 2 ; but I reckon it's 6 ) - either way inching forward...

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.