Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
added 2 characters in body
Source Link
dev_oper

The first command works and the second doesn't. What do I need to change to allow the json array to work? Thank you in advance.

command #1:

curl -d '{"uid":"TEST", "object":"TEST"}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

command #2

curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

The first command works and the second doesn't. What do I need to change to allow the json array to work? Thank you in advance.

command #1:

curl -d '{"uid":"TEST", "object":"TEST"}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

command #2

curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

The first command works and the second doesn't. What do I need to change to allow the json array to work? Thank you in advance.

command #1:

curl -d '{"uid":"TEST", "object":"TEST"}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

command #2

curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory
added 13 characters in body
Source Link
Charles Duffy

The first command works and the second doesn't. What do I need to change to allow the json array to work? Thank you in advance.

command #1
curl -d '{"uid":"TEST", "object":"TEST"}' \ -H "Content-Type: application/json" \ -X POST http://WEBSERVER/api/v1/inventory:

curl -d '{"uid":"TEST", "object":"TEST"}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

command #2
curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \ -H "Content-Type: application/json" \ -X POST http://WEBSERVER/api/v1/inventory

curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

The first command works and the second doesn't. What do I need to change to allow the json array to work? Thank you in advance.

command #1
curl -d '{"uid":"TEST", "object":"TEST"}' \ -H "Content-Type: application/json" \ -X POST http://WEBSERVER/api/v1/inventory

command #2
curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \ -H "Content-Type: application/json" \ -X POST http://WEBSERVER/api/v1/inventory

The first command works and the second doesn't. What do I need to change to allow the json array to work? Thank you in advance.

command #1:

curl -d '{"uid":"TEST", "object":"TEST"}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory

command #2

curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \
        -H "Content-Type: application/json" \
        -X POST http://WEBSERVER/api/v1/inventory
Source Link
dev_oper

curl with json array

The first command works and the second doesn't. What do I need to change to allow the json array to work? Thank you in advance.

command #1
curl -d '{"uid":"TEST", "object":"TEST"}' \ -H "Content-Type: application/json" \ -X POST http://WEBSERVER/api/v1/inventory

command #2
curl -d '{"uid":"TEST","object":["server1", "server2", "server3"]}' \ -H "Content-Type: application/json" \ -X POST http://WEBSERVER/api/v1/inventory

lang-bash