Design actions
GetElements
Description
The GetElements method retrieves the list of elements from a specified path. This call is synchronous - it blocks until all elements have been retrieved.
Parameters
- Path (required): A string representing the path of an element. Character ‘|’ is used as separator in the path string (for example UserPath|Actions|transaction|page|request).
- ApiKey (optional): To authenticate the command. Required if enabled on the Controller.
REST example
To get the elements with path “UserPath|Actions|transaction|page|request”:
HTTP request
POST http://localhost:7400/Design/v1/Service.svc/GetElements HTTP/1.1Content-Type:application/json{"d":{"Path":"UserPath|Actions|transaction|page|request"}}HTTP response
HTTP/1.1 200 OK{"d":{"results":[{"__metadata":{"id":"http://localhost:7400/Design/v1/Service.svc/GetElements('')","uri":"http://localhost:7400/Design/v1/Service.svc/GetElements('')","type":"com.neotys.neoload.api.design.GetElements"},"ApiKey":"","Path":"UserPath|Actions|transaction|page|request","Element":{"__metadata":{"type":"com.neotys.neoload.api.design.Element"},"Uid":"4c9563d7-1833-48ff-8abe-1a1647e94b08","Type":"ACTION","Parent":"0f2df16f-7bd7-4245-b220-b89f4039f4d3","JsonDefinition":"{\"Name\":\"request\"}"}}]}}Use case with Command Line Designer
-Not available at this time.
Use case with Java Client Designer
import com.neotys.rest.design.client.DesignAPIClient;import com.neotys.rest.design.client.DesignAPIClientFactory;import com.neotys.rest.design.model.GetElementsParams.GetElementsParamsBuilder;import com.neotys.rest.design.model.element.Element;public class Main {public static void main(String[] args) throws Exception {final String url = "http://localhost:7400/Design/v1/Service.svc";final DesignAPIClient client = DesignAPIClientFactory.newClient(url);final GetElementsParamsBuilder builder = new GetElementsParamsBuilder().path("UserPath|Actions|transaction|page|request");for(final Element element : client.getElements(builder.build())){System.out.println(element.getUID());}}}
A Java helper is available to ease the management of User Path elements. See the UserPathBuilder Java helper page for more details.
Use case with C#Client
-Not available at this time.
AddElement
Description
The AddElements method creates a design element (User Path, Transaction, Delay, etc.) and inserts it in a project. This call is synchronous - it blocks until the element is created and inserted.
Parameters
- Type (required): A string describing the type of element to create. List of supported types are declared in Java class com.neotys.rest.design.model.element.ElementType.
For example, to create a User Path, the type must be filled with string “UserPath”. Type string is case insensitive.- Parent (optional): A string describing the UID of the parent element in which the element has to be inserted. If the element to create is a root element (User Path, Population, etc.), then no Parent needs to be specified.
- Definition (optional): A string describing the JSON definition of the element to create.
For example, to create element with name “myName” and description “myDescription”, the JSON string has to be {"Name":"myName", "Description":"myDescription"}.- Index (optional): An integer to specify the position to insert the element in the parent. If not specified, element is added at the last position.
- ApiKey (optional): To authenticate the command. Required if enabled on the Controller.
REST example
To create a UserPath:
HTTP request
POST http://localhost:7400/Design/v1/Service.svc/AddElement HTTP/1.1Content-Type:application/json{"d":{"Type":"UserPath", "JsonDefinition":"{\"Name\":\"myUserPath\", \"Description\":\"myUserPathDescription\"}"}}HTTP response
HTTP/1.1 200 OK{"d":{"__metadata":{"id":"http://localhost:7400/Design/v1/Service.svc/AddElement('')","uri":"http://localhost:7400/Design/v1/Service.svc/AddElement('')","type":"com.neotys.neoload.api.design.AddElement"},"ApiKey":"","Type":"UserPath","Parent":null,"JsonDefinition":"{\"Name\":\"myUserPath\", \"Description\":\"myUserPathDescription\"}","Index":null,"Element":{"__metadata":{"type":"com.neotys.neoload.api.design.Element"},"Uid":"myUserPath","Type":"UserPath","Parent":"1d4a8dc6-a2ac-3755-a149-77daa7d3648f","JsonDefinition":"{\"Description\":\"myUserPathDescription\",\"Name\":\"myUserPath\"}"}}}To create a Transaction and insert it in the Action container (UID : 68e22d80-f0f9-469a-88c8-e3171ab5fc0e):
HTTP request
POST http://localhost:7400/Design/v1/Service.svc/AddElement HTTP/1.1Content-Type:application/json{"d":{"Type":"Transaction", "Parent":"68e22d80-f0f9-469a-88c8-e3171ab5fc0e","JsonDefinition":"{\"Name\":\"myTransaction\", \"Description\":\"myTransactionDescription\"}"}}
HTTP response
HTTP/1.1 200 OK{"d":{"__metadata":{"id":"http://localhost:7400/Design/v1/Service.svc/AddElement('')","uri":"http://localhost:7400/Design/v1/Service.svc/AddElement('')","type":"com.neotys.neoload.api.design.AddElement"},"ApiKey":"","Type":"Transaction","Parent":"68e22d80-f0f9-469a-88c8-e3171ab5fc0e","JsonDefinition":"{\"Name\":\"myTransaction\", \"Description\":\"myTransactionDescription\"}","Index":null,"Element":{"__metadata":{"type":"com.neotys.neoload.api.design.Element"},"Uid":"5181bf96-0105-43d9-a4e2-1f637ef41040","Type":"Transaction","Parent":"68e22d80-f0f9-469a-88c8-e3171ab5fc0e","JsonDefinition":"{\"Description\":\"myTransactionDescription\",\"Name\":\"myTransaction_3\"}"}}}Use case with Command Line Designer
-Not available at this time.
Use case with Java Client Designer
import com.neotys.rest.design.builder.JSONDefinitionBuilder;import com.neotys.rest.design.client.DesignAPIClient;import com.neotys.rest.design.client.DesignAPIClientFactory;import com.neotys.rest.design.model.AddElementParams.AddElementParamsBuilder;import com.neotys.rest.design.model.GetElementsParams.GetElementsParamsBuilder;import com.neotys.rest.design.model.element.ElementType;public class Main {public static void main(String[] args) throws Exception {final String url = "http://localhost:7400/Design/v1/Service.svc";final DesignAPIClient client = DesignAPIClientFactory.newClient(url);// Get the UID of the Action container of the UserPath "myUserPath"final String actionContainerUID = client.getElements(new GetElementsParamsBuilder().path("myUserPath|Actions").build()).get(0).getUID();// Create a Delay with name "myDelay" and description "myDelayDescription", and insert it in the Action container:final String delayDefinition = new JSONDefinitionBuilder().name("myDelay").description("myDelayDescription").put("Duration", "5000").build();client.addElement(new AddElementParamsBuilder().type(ElementType.DELAY.key()).definition(delayDefinition).parent(actionContainerUID).build());}}
A Java helper is available to ease the management of User Path elements. See the UserPathBuilder Java helper page for more details.
Use case with C#Client
-Not available at this time.
GetChildren
Description
The GetChildren method retrieves the list of children of an element specified by its UID. This call is synchronous - it blocks until all children have been retrieved.
Parameters
- Uid (required): A string specifying the UID of the element of which we need to retrieve the children.
- ApiKey (optional): To authenticate the command. Required if enabled on the Controller.
REST example
To get the children of the UserPath “myUserPath”:
HTTP request
POST http://localhost:7400/Design/v1/Service.svc/GetChildren HTTP/1.1Content-Type:application/json{"d":{"Uid":"myUserPath"}}HTTP response
HTTP/1.1 200 OK{"d":{"results":[{"__metadata":{"id":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","uri":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","type":"com.neotys.neoload.api.design.GetChildren"},"ApiKey":"","Uid":"myUserPath","Element":{"__metadata":{"type":"com.neotys.neoload.api.design.Element"},"Uid":"51e0bf87-c458-4286-8a64-08f401f86638","Type":"INIT_CONTAINER","Parent":"myUserPath","JsonDefinition":"{\"Description\":\"Elements executed once when the Virtual User starts.\",\"Name\":\"Init\"}"}},{"__metadata":{"id":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","uri":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","type":"com.neotys.neoload.api.design.GetChildren"},"ApiKey":"","Uid":"myUserPath","Element":{"__metadata":{"type":"com.neotys.neoload.api.design.Element"},"Uid":"24f0d61a-38c4-4ffa-868b-e2b4331a4282","Type":"ACTIONS_CONTAINER","Parent":"myUserPath","JsonDefinition":"{\"Description\":\"Elements repeated until the Virtual User stops.\",\"Name\":\"Actions\"}"}},{"__metadata":{"id":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","uri":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","type":"com.neotys.neoload.api.design.GetChildren"},"ApiKey":"","Uid":"myUserPath","Element":{"__metadata":{"type":"com.neotys.neoload.api.design.Element"},"Uid":"d811403e-9a8d-4932-b027-2691e3cb71bf","Type":"END_CONTAINER","Parent":"myUserPath","JsonDefinition":"{\"Description\":\"Elements executed before the Virtual User stops.\",\"Name\":\"End\"}"}}]}}To get the children of the Actions container of “myUserPath” (UID : 24f0d61a-38c4-4ffa-868b-e2b4331a4282)
HTTP request
POST http://localhost:7400/Design/v1/Service.svc/GetChildren HTTP/1.1Content-Type:application/json{"d":{"Uid":"24f0d61a-38c4-4ffa-868b-e2b4331a4282"}}
HTTP response
HTTP/1.1 200 OK{"d":{"results":[{"__metadata":{"id":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","uri":"http://localhost:7400/Design/v1/Service.svc/GetChildren('')","type":"com.neotys.neoload.api.design.GetChildren"},"ApiKey":"","Uid":"24f0d61a-38c4-4ffa-868b-e2b4331a4282","Element":{"__metadata":{"type":"com.neotys.neoload.api.design.Element"},"Uid":"7b56c556-487c-4447-a541-31b9336c5e48","Type":"Transaction","Parent":"24f0d61a-38c4-4ffa-868b-e2b4331a4282","JsonDefinition":"{\"Name\":\"transaction\"}"}}]}}Use case with Command Line Designer
-Not available at this time.
Use case with Java Client Designer
import com.neotys.rest.design.client.DesignAPIClient;import com.neotys.rest.design.client.DesignAPIClientFactory;import com.neotys.rest.design.model.GetChildrenParams.GetChildrenParamsBuilder;import com.neotys.rest.design.model.GetElementsParams.GetElementsParamsBuilder;import com.neotys.rest.design.model.element.Element;public class Main {public static void main(String[] args) throws Exception {final String url = "http://localhost:7400/Design/v1/Service.svc";final DesignAPIClient client = DesignAPIClientFactory.newClient(url);// Get children of the UserPath "myUserPath":for(final Element element : client.getChildren(new GetChildrenParamsBuilder().uid("myUserPath").build())){System.out.println(element.getJSON());}// Get children of the Actions container of “myUserPath”final String actionContainerUID = client.getElements(new GetElementsParamsBuilder().path("myUserPath|Actions").build()).get(0).getUID();// Get children of the UserPath "myUserPath":for(final Element element : client.getChildren(new GetChildrenParamsBuilder().uid(actionContainerUID).build())){System.out.println(element.getJSON());}}}
A Java helper is available to ease the management of User Path elements. See the UserPathBuilder Java helper page for more details.
Use case with C#Client
-Not available at this time.
Home