Я использую демонстрационный экземпляр для запроса service-now.Использование cURL работает нормально, но я хочу использовать Java для запроса API таблиц.Я следовал за этим .Я правильно указал свои учетные данные и имя экземпляра.Я получаю сообщение об ошибке:
$ javac GetAction.java
GetAction.java:6: error: package org.apache.http does not exist
import org.apache.http.HttpException;
^
GetAction.java:7: error: package org.apache.http does not exist
import org.apache.http.HttpHost;
^
GetAction.java:8: error: package org.apache.http.auth does not exist
import org.apache.http.auth.AuthScope;
^
GetAction.java:9: error: package org.apache.http.auth does not exist
import org.apache.http.auth.UsernamePasswordCredentials;
^
GetAction.java:10: error: package org.apache.http.client does not exist
import org.apache.http.client.CredentialsProvider;
^
GetAction.java:11: error: package org.apache.http.client.methods does not exist
import org.apache.http.client.methods.CloseableHttpResponse;
^
GetAction.java:12: error: package org.apache.http.client.methods does not exist
import org.apache.http.client.methods.HttpGet;
^
GetAction.java:13: error: package org.apache.http.impl.client does not exist
import org.apache.http.impl.client.BasicCredentialsProvider;
^
GetAction.java:14: error: package org.apache.http.impl.client does not exist
import org.apache.http.impl.client.CloseableHttpClient;
^
GetAction.java:15: error: package org.apache.http.impl.client does not exist
import org.apache.http.impl.client.HttpClients;
^
GetAction.java:16: error: package org.apache.http.util does not exist
import org.apache.http.util.EntityUtils;
^
GetAction.java:19: error: cannot find symbol
public static void main(String[] args) throws IOException, HttpException {
^
symbol: class HttpException
location: class GetAction
GetAction.java:24: error: cannot find symbol
public void getRequest() throws HttpException, IOException {
^
symbol: class HttpException
location: class GetAction
GetAction.java:25: error: cannot find symbol
CredentialsProvider credsProvider = new BasicCredentialsProvider();
^
symbol: class CredentialsProvider
location: class GetAction
GetAction.java:25: error: cannot find symbol
CredentialsProvider credsProvider = new BasicCredentialsProvider();
^
symbol: class BasicCredentialsProvider
location: class GetAction
GetAction.java:27: error: cannot find symbol
new AuthScope(new HttpHost("xxxxxxxx.service-now.com")),
^
symbol: class AuthScope
location: class GetAction
GetAction.java:27: error: cannot find symbol
new AuthScope(new HttpHost("xxxxxxxx.service-now.com")),
^
symbol: class HttpHost
location: class GetAction
GetAction.java:28: error: cannot find symbol
new UsernamePasswordCredentials("wwwww", "yyyyyy"));
^
symbol: class UsernamePasswordCredentials
location: class GetAction
GetAction.java:29: error: cannot find symbol
CloseableHttpClient httpclient = HttpClients.custom()
^
symbol: class CloseableHttpClient
location: class GetAction
GetAction.java:29: error: cannot find symbol
CloseableHttpClient httpclient = HttpClients.custom()
^
symbol: variable HttpClients
location: class GetAction
GetAction.java:34: error: cannot find symbol
HttpGet httpget = new HttpGet("https://xxxxxxxx.service-now.com/api/now/table/incident?sysparm_query=number%3DINC0000057&sysparm_limit=1");
^
symbol: class HttpGet
location: class GetAction
GetAction.java:34: error: cannot find symbol
HttpGet httpget = new HttpGet("https://xxxxxxxx.service-now.com/api/now/table/incident?sysparm_query=number%3DINC0000057&sysparm_limit=1");
^
symbol: class HttpGet
location: class GetAction
GetAction.java:37: error: cannot find symbol
CloseableHttpResponse response = httpclient.execute(httpget);
^
symbol: class CloseableHttpResponse
location: class GetAction
GetAction.java:41: error: cannot find symbol
String responseBody = EntityUtils.toString(response.getEntity());
^
symbol: variable EntityUtils
location: class GetAction
24 errors
Как заставить работать код документации?Любая помощь будет оценена.