V-Spark Online Help

Using the /appedit API with cURL

If you are unfamiliar with the cURL command, see Using cURL for REST API Testing for a short introduction and an explanation of how cURL examples are displayed. See Tips for Debugging and Managing cURL Calls for suggestions about how to debug and manage cURL calls.

Application category configurations can be retrieved and updated using the /appedit API. The following examples demonstrates saving an application's category configuration to a JSON file so that it can be edited, either manually or programmatically, and then updated.

For more information about application category configuration, see the Upload and Download an Application Config section of the V‑Spark Application Development Guide.

Application category configurations can be retrieved using a GET call to the /appedit API. The following command demonstrates retrieving the configuration of an application named "AppEdit Test", located under the Technologies company, in the Technologies-RD organization. The JSON that is retrieved is written to a JSON file named AppEdit-Test.json:

curl -s "http://example.company.com/appedit/Technologies/Technologies-RD/AppEdit%20Test?token=TOKEN" > AppEdit-Test.json    

Note

Because the names of applications can contain spaces, you must URL-encode each space in the name of an application by replacing it with %20.

Application category configurations can be updated using a POST call to the /appedit API. The configurations contain the entire application and therefore require every category to be present in order to preserve that structure. You can not POST a configuration for only one category at a time.

The following command demonstrates uploading the configuration of an application named AppEdit Test, located under the Technologies company, in the Technologies-RD organization, from the JSON file AppEdit-Upd.json:

curl -s -X POST -H "Content-Type:application/json" --data @AppEdit-Upd.json \
    "http://example.company.com/appedit/Technologies/Technologies-RD/AppEdit%20Test?token=TOKEN"

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

You must also use the following cURL options:

-X

Identifies the request method to use (POST) when communicating with the target HTTP server

-H

Identifies the type of content that you are sending ( "Content-Type:application/json").

-d

Identifies 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.