要创建 Plivo 应用程序,您不需要创建 XML 文件。相反,您需要发出 Plivo 应用程序 API 请求或使用 java 帮助程序库。这是制作 Plivo 应用程序的示例代码:
package plivoexample;
import java.util.LinkedHashMap;
import com.plivo.helper.api.client.*;
import com.plivo.helper.api.response.application.Application;
import com.plivo.helper.exception.PlivoException;
public class App {
public static void main(String[] args) throws IllegalAccessException {
String auth_id = "Your_AUTH_ID";
String auth_token = "Your_AUTH_TOKEN";
RestAPI api = new RestAPI(auth_id, auth_token, "v1");
LinkedHashMap<String, String> params = new LinkedHashMap<String, String>();
// The URL Plivo will fetch when a call executes this application
parameters.put("answer_url","http://example.com");
parameters.put("app_name","Testing_App"); // The name of your application
try {
// Create an Application
Application resp = api.createApplication(params);
System.out.println((resp));
} catch (PlivoException e) {
System.out.println(e.getLocalizedMessage());
}
}
}
有关更多详细信息,请参阅https://www.plivo.com/docs/getting-started/application-api/。