String name = "xyz";
String password = "xyz";
String authString = name + ":" + password;
String authStringEnc = new BASE64Encoder().encode(authString.getBytes());
static String URL = "https://api.messagemedia.com";
String getURI = "/v1/replies";
static String postURI = "/v1/replies/confirmed";
static Client client = ClientBuilder.newClient();
public Data getRequest() {
Response response = (Response) client.target(URL + getURI).request(MediaType.APPLICATION_JSON_TYPE)
.header("Accept", "application/json").header("Authorization", "Basic " + authStringEnc).get();
}
我确定我已经将其配置正确,但我似乎无法理解我做错了什么。"
答案 0 :(得分:0)
MessageMedia Developer Evangelist在这里。
我认为您可能会将字节分配给String变量。试一试:
String name = "kD4ub2gYkvO82mGYidRU";
String password = "iOwj2pbhwB8Ukqu4hgKmCSUSi8bzVB";
String authString = name + ":" + password;
byte[] authStringEnc = new BASE64Encoder().encode(authString.getBytes());
String authStringConv = new String(authStringEnc);
static String URL = "https://api.messagemedia.com";
String getURI = "/v1/replies";
static String postURI = "/v1/replies/confirmed";
static Client client = ClientBuilder.newClient();
public Data getRequest() {
Response response = (Response) client.target(URL + getURI).request(MediaType.APPLICATION_JSON_TYPE).header("Content-Type", "application/json").header("Authorization", "Basic " + authStringConv).get();
}