Deleting Applications with API
You can delete applications from your project using the endpoint /api/v1/applications/<applicationId>/delete
.
The request is a post request, and you will have to retrieve the application id before you can send the request to delete.
To get the application ID, list the application in your project.
This is an example of a JSON Formatted Response. The application ID is the second parameter in the returned object.
List Response
{
"name":"com.experitest.UIKitCatalog",
"id":173321,
"packageName":null,
"version":"13.2",
"applicationName":"UIKitCatalog",
"notes":null,
"productId":"com.experitest.UIKitCatalog",
"mainActivity":null,
"cameraSupport":false,
"osType":"IOS",
"createdAt":1521963471926,
"versionNumber":0,
"createdAtFormatted":"2018-03-25 10:37:51",
"instrumentByProfile":null,
"nonInstrumented":false,
"bundleIdentifier":"com.experitest.UIKitCatalog"
}
Java
You need the OKHttpClient library. You can get from Maven (if you use maven or gradle).
Delete Applications with Java Expand source
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import org.junit.Test;
import java.io.IOException;
public class Applications {
@Test
public void listApplications() throws IOException {
OkHttpClient client = new OkHttpClient();
String appId = "<APP_ID>";
RequestBody requestBody = RequestBody.create(null, "");
Request request = new Request.Builder()
.url("https://cloud.seetest.io/api/v1/applications/" + appId + "/delete")
.post(requestBody)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer ACCESS_KEY")
.addHeader("Cache-Control", "no-cache")
.build();
try {
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
} catch (IOException e) {
e.printStackTrace();
}
}
}
Python
For this code to run, you need the Requests package. To get it, run:
pip install requests
Delete Applications with Python Expand source
import requests
url = "https://cloud.seetest.io/api/v1/applications/{}/delete"
app_id = "<APP_ID>"
headers = {
'Content-Type': "application/json",
'Authorization': "Bearer <ACCESS_KEY>",
'Cache-Control': "no-cache",
}
response = requests.request("POST", url.format(app_id), headers=headers)
print(response.text)
C#
For this code to run, you need the RestSharp library. To get it using the NuGet Package Manager, run: Install-Package RestSharp
Delete Applications with C# Expand source
using RestSharp;
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var appId = "<APP_ID>";
var client = new RestClient("https://cloud.seetest.io/api/v1/applications/" + appId + "/delete");
RestRequest restRequest = new RestRequest(Method.POST);
restRequest.RequestFormat = DataFormat.Json;
restRequest.AddHeader("Authorization", "Bearer <ACCESS_KEY>");
restRequest.AddHeader("Content-Type", "application/json");
var response = client.Execute(restRequest);
Console.WriteLine(response.Content);
}
}
}
Ruby
Delete Applications with Ruby Expand source
require 'uri'
require 'net/http'
app_id = '<APP_ID>'
url = URI("https://cloud.seetest.io/api/v1/applications/#{app_id}/delete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request["Authorization"] = 'Bearer <ACCESS_KEY>'
request["Cache-Control"] = 'no-cache'
response = http.request(request)
puts response.read_body