V-Spark Online Help

Using POST with cURL and the /config API

Use the /config API to update the configuration of a V‑Spark installation.

Note

The /config/system API does not accept POST requests. At this time, the /config/system API only returns system read only settings and read only settings must be updated directly using the /config/system/readonly API.

The cURL commands to POST data to the V‑Spark API are slightly more complex than commands to GET or DELETE portions of a V‑Spark installation. As an example, a sample cURL command to use the JSON file config.json to make sure that the companies that it describes are defined in the V‑Spark installation on the host example.company.com is the following:

curl -s -X POST -H "Content-Type:application/json" \
     "http://example.company.com/config?token=TOKEN" --data @config.json

When using cURL and a command like this one to POST data to a host, the information about the protocol, host, and port is required, as is the token that ensures that you have rights to access the V‑Spark installation.

You must also use the following cURL options:

Table 1. cURL Options

Name

Type

Values

Description

-X

POST, GET, DELETE

The request method to use when communicating with the target HTTP server

-H

MIME Content Type

The type of content that you are sending (For example, "Content-Type:application/json").

-d

The data that you are sending to the HTTP server. File names must be preceded by an @ symbol. You can also use the - symbol after an @ symbol to indicate that the data to send to the HTTP server will be coming from standard input on your system (such as when a cURL POST command uses a pipe to receive data from another application).



The cURL command's -s command-line argument is optional, causing the cURL command to run in silent mode, where it does not display progress information or error messages.

Data that is written to a V‑Spark installation is additive - if some of the objects that are described by portions of the data that you are writing already exist, they will be updated (if necessary) to reflect their descriptions in your JSON data. Only objects that do not exist will be created. Objects that already exist but are not described in your JSON input will be preserved in their current configuration.