# HTTP-Level API Functions Reference

<meta charset="UTF-8" id="bkmrk-"></meta><title id="bkmrk-http-level-api-funct">HTTP Level API functions - Appvance Test Designer JS Commands</title><style id="bkmrk-body-%7B-font-family%3A-">
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; max-width: 900px; margin: 0 auto; padding: 20px; line-height: 1.6; }
h1 { color: #1a73e8; border-bottom: 2px solid #1a73e8; padding-bottom: 8px; }
h3 { color: #333; margin-top: 24px; }
code { background: #f0f0f0; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
pre { background: #f5f5f5; padding: 12px; border-radius: 4px; overflow-x: auto; }
blockquote { background: #f9f9f9; border-left: 4px solid #1a73e8; margin: 12px 0; padding: 8px 16px; }
p.note { background: #fff3cd; border-left: 4px solid #ffc107; padding: 8px 16px; }
</style></head><body>### \_get = get

Parameters: url  
Description: Executes a GET HTTP call, and returns the HTTP response.  
Example:

> `_prepareDomain("`https://www.wikipedia.org`");`  
> `var response = _get("/");`  
> `assertEqual(response.status,200);`  
> `assertEqual(response.headers.contentType.first,"text/html");`  
> `log("response.getDataString()"+response.getDataString());`  
> `assertContains(response.getDataString(),"wikipedia");`

### \_createGet = createGet

Parameters: url  
Description: creates an HTTP GET request object. The object can be used to add headers, and to execute it just need to execute an eval.  
Example:

> `_setDomain("`http://localhost:9090`");`  
> `var myGet = _createGet("`http://localhost:9090/ds/dyn/basic/echo`");`  
> `myGet.addUpdateQueryAction("echo","?echo=4&data=7",false);`  
> `assertEqual("?echo=4&data=7", myGet.eval().toStringContent());`

### \_createPost = createPost

Parameters: url  
Description: creates an HTTP POST request object. The object can be used to add headers, and to execute it just need to execute an eval.  
Example:

> `var myPost = createPost("`https://appvancetest.service-now.com:443/api/now/ui/page\_timing/7d9bd42f13e71b00ae43721a6144b0b5`");`  
> `myPost.addHeader("Content-Type", "application/json");`  
> `myPost.addHeader("X-Requested-With", "XMLHttpRequest");`  
> `myPost.setContentType("application/json");`  
> `var resp = myPost.eval().getContentString();`

### <span>\_createPatch = createPatch</span> 

Parameters: url

Description: creates an HTTP POST request object. The object can be used to add headers, and to execute it just need to execute an eval.  
Example:

> `var call = createPost("`https://appvancetest.service-now.com:443/api/now/ui/page\_timing/7d9bd42f13e71b00ae43721a6144b0b5`");`  
> `call.addHeader("Content-Type", "application/json");`  
> `call.addHeader("X-Requested-With", "XMLHttpRequest");`  
> `call.setContentType("application/json");`  
> `var call = call.eval().getContentString();`

<span>\_createPut = createPut</span>

Parameters: url  
Description: creates an HTTP PUT request object. The object can be used to add headers, and to execute it just need to execute an eval.  
Example:

> `_setDomain("`http://localhost:9090`");`  
> `var call = _createPut("`http://localhost:9090/ds/dyn/basic/echo?echo=4&amp;data=7`");`  
> `log(call.eval().toStringContent());`

### \_createHead = createHead

Parameters: url  
Description: creates an HTTP PUT request object. The object can be used to add headers, and to execute it just need to execute an eval.  
Example:

> `_setDomain("`http://localhost:9090`");`  
> `var call = _createHead("`http://localhost:9090/ds/dyn/basic/echo?echo=4&amp;data=7`");`  
> `log(call.eval().toStringContent());`

<span>\_createOptions = createOptions</span>

Parameters: url  
Description: creates an HTTP PUT request object. The object can be used to add headers, and to execute it just need to execute an eval.  
Example:

> `_setDomain("`http://localhost:9090`");`  
> `var call = _createHead("`http://localhost:9090/ds/dyn/basic/echo?echo=4&amp;data=7`");`  
> `log(call.eval().toStringContent());`

Functions used by AI processes

### \_pageStructure= pageStructure(validDomains, type)

Parameters:

- validDomains a list of valid domains with its protocol for main windows we want to get the structure. It accepts<span> JSONArray, ArrayList and String\[\]</span>
- type: The type of elements the pageStructure wil provide. Currently, <span>Smarttags, Inputs, Tags, SmarttagsInputs and SmarttagsTags</span> are the valid values to pass.
 
Description: gets the current page Structure based on [DS3 Page Structure](../TechnicalRef_DS3PageStructure.htm).

Example:

> `addSmartTagsLibrary("demosite.stags");`   
> `var pageStructure = pageStructure("https://demosite.appvance.com","Smarttags");`

### \_setCompatibility = setCompatibility

Parameters: <span>boolean</span>  
Description: Enables the compatibility mode for sites that run in legacy Internet Explorer versions.

Internet Explorer is no longer supported browser in AIQ.  
Example:

> `_setCompatibility(true);`   
> `_navigateTo("`http://sahitest.com/`");`  
> `_click(_link("demo"));`

### \_getCompatibility = getCompatibility

<span>Description:</span>   
Example:

> `_setCompatibility(true);`   
> `assertTrue(_getCompatibility());`   
> `_navigateTo("`https://A`pplicationURL");`  
> `_setValue(_textbox("user"), $UserName);`  
> `_setValue(_password("password"), $Password);`  
> `_click(_submit("Login"));`  
> `_click(_cell($PatientNumber));`  
>   
> `if (var1 == "No data entered \nClick to view CRF") {`  
> `_click(_link("Logout"));`  
> `} else {`  
> `_click(_button(19));`  
> `_click(_link("Logout"));`  
> `}`  
> `_setCompatibility(false);`  
> `_assertFalse(_getCompatibility());`

<div id="bkmrk-last-updated%3A-june-0">---

Last updated: <span class="mc-variable General.NewDateTimeVariable variable">June 05, 2024</span>

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>

 </div> <a data-close="true" id="bkmrk--6"></a>