cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1074
Views
0
Helpful
4
Replies

Jabber Guest - create link with Guest API

dodu15061
Level 1
Level 1

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;

4 Replies 4

smupadhy
Cisco Employee
Cisco Employee

Hello Dominik,

Can you send us the raw request and response for the failing requests (i.e. captured via Fiddler)?

Thanks,

Smita

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

Bticest_jt
Level 1
Level 1

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

stanleyworks
Level 1
Level 1

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!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: