Share this page

# Upload or retrieve scripts

## Description

Uploads the following scripts to, or retrieves them from LoadRunner Enterprise or ALM (for VuGen and JMeter scripts):

Script Type | Supported in Version
--- | ---
DevWeb (standalone) | LoadRunner Enterprise 2020 SP3 or later
Gatling | LoadRunner Enterprise 2020 SP3 or later
UFT One GUI or API tests | LoadRunner Enterprise 2020 SP3 or later
VuGen | LoadRunner Enterprise 2020 or later ALM (in versions 12.6x or earlier)
JMeter | LoadRunner Enterprise 2020 or later ALM (in versions 12.6x or earlier)
Kafka | LoadRunner Enterprise 2022 or later

## URL

Copy code

    /LoadTest/rest/domains/{domainName}/projects/{projectName}/Scripts

## Remarks

None

## HTTP Method

POST: Uploads a VuGen, JMeter, DevWeb, Gatling, or UFT One GUI or API test script to LoadRunner Enterprise or to ALM (for VuGen or JMeter scripts).

GET: Returns the script in the body of the response.

## Request

Headers:

Content-Type: multipart/form-data

Cookies:

Version 2020 (or later) | LWSSO_COOKIE_KEY={LwssoCookie};
Versions earlier than 2020 | LWSSO_COOKIE_KEY={LwssoCookie};QCSession={QCSessionCookie};

Request Body:

POST: Multipart data with two entities: a zipped script and an XML describing the uploaded script.

1. In the Body section of the API tool, add the XML as Text.

2. Add XML to the file (see the POST example below and the field descriptions in the table).

3. Add the zipped script to the body as a File.

4. After uploading the script, you should receive the response (see Script XML).

GET: No request body

Request Example - POST
Copy code

    POST http://<LRE_Server>/LoadTest/rest/domains/alex-qc/projects/demo_project/Scripts
    Content-Type: multipart/form-data; boundary="d8a33232-f54d-4fa6-a888-0b6b34810dfc"
    Content-Length: <content length>
    Expect: 100-continue
    --d8a33232-f54d-4fa6-a888-0b6b34810dfc
    Content-Disposition: form-data; name=metadata

    <Script xmlns="http://www.hp.com/PC/REST/API">
         <TestFolderPath>path to upload the script to LRE/ALM</TestFolderPath>
         <Overwrite>true</Overwrite>
         <RuntimeOnly>false</RuntimeOnly>
         <KeepCheckedOut>false</KeepCheckedOut>
     </Script>

    --d8a33232-f54d-4fa6-a888-0b6b34810dfc
    Content-Disposition: form-data; filename=ScriptWithVuserLog.zip
    Content-Type: application/x-zip-compressed
    <Content of the compressed script>
    --d8a33232-f54d-4fa6-a888-0b6b34810dfc--

Note: The value of the element boundary which marks the start and the end of the elements in HTTP multipart/form-data request is a value that can be changed based on the library being used (`d8a33232-f54d-4fa6-a888-0b6b34810dfc` is an example of a boundary value).

Request Example - GET
Copy code

    GET http://<LRE_Server>/LoadTest/rest/domains/alex-qc/projects/demo_project/Scripts

The fields in the request are:

Element | Description
--- | ---
Script | The top-level element.
TestFolderPath | This is the path of the folder on LoadRunner Enterprise (or within Test Plan for ALM) where the script will be saved.
Overwrite | Action if script with the same pathname already exists. One of: true: Overwrite existing script. (default) false: Automatically rename new script.
RuntimeOnly | One of: true: Upload only runtime files. (default) false: Upload all files.
KeepCheckedOut (Not relevant in LoadRunner Enterprise 2020 or later) | Applies if project supports versioning to indicate whether the script needs to be checked in/out after an upload. Use one of: true: Uploaded script will remain checked-out. false: Uploaded script is checked in. (default). Note: If the project does not support version control, this element is meaningless and you can leave the default value ("false") or not use the `KeepCheckedOut` element at all. Do not send an empty element.
IsAutosplitJMX | (For JMeter scripts only) Select "true" to split a .jmx file that contains a number of JMeter groups into a separate .jmx file for each group.

## Response

Headers:

Content-Type: application/xml

Cookies:

None

HTML Return Code:

One of the HTTP Return Codes

HTML Body:

GET: Returns the data on the entity in the response. See Script XML

## See Also

Returns or deletes a script by ID
Script XML

Tips to improve your search results... LoadRunner Enterprise REST API Reference LRE REST API All View Local Help Center View Online Help Center back Go back in browser history forward Go forward in browser history Remove search highlights next topic Go to next topic previous topic Go to previous topic Print the current topic(Undefined variable: _rscC_Basic_Variables.VersionLabel)