10-07-2014 01:31 PM
I used this code and everytime i get a 400 Bad Request Error. There will be no link created. I think the basic authentication doesn't work. But I don't no why.
String destination = "test_Destination";
if (displayName == null)
displayName = destination;
if (requestPath == null)
requestPath = destination;
JsonObject linkObject = new JsonObject()
.add( "isEnabled", true )
.add( "destination", destination )
.add( "displayName", "User" )
.add( "callerName", "Caller" )
.add( "requestPath", "randomUUID" );
if (validAfter != null)
linkObject.add( "validAfter", dateToJSON(validAfter));
if (validBefore != null)
linkObject.add( "validBefore", dateToJSON(validBefore));
try{
HttpRequest r = HttpRequest
.post(https://1.2.3.4/cjg-api/rest/links)
.contentType("application/json")
.accept("application/json")
.basic("admin","123456")
.trustAllCerts() // For self signed certs
.send(linkObject.toString());
// Look for HTTP code 201 ("CREATED")
if (r.code() == 201)
// Link created, get link URL from Location header
return r.header("Location");
else
System.out.println("Error creating link: " + r.code());
} catch (Exception e) {
System.out.println("Exception creating link: " + e.getMessage());
}
return null;
10-08-2014 01:55 PM
Hello Dominik,
Can you send us the raw request and response for the failing requests (i.e. captured via Fiddler)?
Thanks,
Smita
10-08-2014 03:20 PM
For some version of JG, you have to get "userObjectId" from user DB with 'rest/users/' and set the "userObjectId" field along with other fields to insert/update links.
Regards,
David
10-20-2014 08:43 PM
Hi Dominik,
I've done this success before.
Have you ever been working with CUMI API?
You can download the CUMI sample code and see how it works via JAVA.
SSL is important.
HTTPS header was built via 'HttpURLConnection' instead of 'HttpRequest'.
Would this help.
Thanks Jeff
07-31-2015 11:56 AM
Hi
Have you resolved this issue? I am trying to get a basic script together so a user can enter the destination address in a prompt and it will create the link for them.
We don't want users to have admin access to Jabber Guest, just to be able to streamline the creation of links.
Thanks!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide