• Domino Mail Service - Error in JSON

    By Mark A Barton 1 decade ago

    The API call in the Domino Mail Service - http://{host}/api/mail returns an array of folders (links).

    The last element in that array is followed by a comma:

     

    {
    
    "mailboxes":[
    
    {
    
    "owner":{
    
    "displayName":"Duke Lawson",
    
    "distinguishedName":"Duke Lawson\/Peaks",
    
    "email":"DukeLawson@swg.usma.ibm.com"
    
    },
    
    "links":[
    
    {
    
    "rel":"inbox",
    
    "href":"http:\/\/server.xyz.com\/mail\/dlawson.nsf\/api\/mail\/inbox"
    
    },
    
    {
    
    "rel":"outbox",
    
    "href":"http:\/\/server.xyz.com\/mail\/dlawson.nsf\/api\/mail\/outbox"
    
    },
    
    {
    
    "rel":"sent",
    
    "href":"http:\/\/server.xyz.com\/mail\/dlawson.nsf\/api\/mail\/sent"
    
    },
    
    {
    
    "rel":"drafts",
    
    "href":"http:\/\/server.xyz.com\/mail\/dlawson.nsf\/api\/mail\/drafts"
    
    }, <<<<<<<  PROBLEM HERE
    
    ]
    
    }
    
    ]
    
    }
    

    This breaks the JSON and means it cannot be parsed.

    • Error in the documentation ...

      By Dave Delay 1 decade ago

      That JSON sample is from the mail service documentation.  There's definitely an error in the documentation, but we haven't seen the same problem in the mail service itself. 

       

      Have you tried parsing an actual response from the mail service?

       

      Thanks.

       

      -- Dave Delay

      • Yes - error when using the mail API

        By Mark A Barton 1 decade ago

        Hi Dave,

        Yes just tried it on my local sever and get this:

        http://192.168.1.30/api/mail

         

        {
          "mailboxes":[
            {
              "owner":{
                "displayName":"Mark Barton",
                "distinguishedName":"Mark Barton\/Shiny",
                "email":""
              },
              "links":[
                {
                  "rel":"inbox",
                  "href":"http:\/\/dev03\/mail\/mbarton.nsf\/api\/mail\/inbox"
                },
                {
                  "rel":"outbox",
                  "href":"http:\/\/dev03\/mail\/mbarton.nsf\/api\/mail\/outbox"
                },
                {
                  "rel":"sent",
                  "href":"http:\/\/dev03\/mail\/mbarton.nsf\/api\/mail\/sent"
                },
                {
                  "rel":"drafts",
                  "href":"http:\/\/dev03\/mail\/mbarton.nsf\/api\/mail\/drafts"
                },
              ]
            }
          ]
        }
        
        Which is wrong and will not validate with jsonlint.
        
        Cheers
        
        Mark

         

        • You are right ...

          By Dave Delay 1 decade ago

          Sorry about that, Mark. 

           

          You are right about the extra comma.  Our unit tests have no trouble parsing the JSON response, so I guess I assumed the mail service code was OK.  The code was definitely wrong, but the fix will be in the next extension library release.

           

          Thanks for letting us know about this!

           

          -- Dave

      • Update - error in server log

        By Mark A Barton 1 decade ago

        Not sure if this will help but this appears in the console (error on the last line):

         

        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 22 [Thread-6] INFO org.apache.wink.server.internal.servlet.RestServlet - The system is using the prop
        
        erties file located at/WEB-INF/das.properties named in the propertiesLocation init-param initialization parameter.
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 39 [Thread-6] INFO org.apache.wink.server.internal.servlet.RestServlet - The system is using the/WEB
        
        -INF/application JAX-RS application class named in the applicationConfigLocation init-param initialization parameter.
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 212 [Thread-6] INFO org.apache.wink.server.internal.application.ApplicationProcessor - The following
        
        JAX-RS application has been processed: org.apache.wink.server.internal.application.ServletWinkApplication
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX
        
        -RS resource class com.ibm.domino.das.resources.ViewDesignResource with @Path(data/collections/{key}/{value}/design).
        
        19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX-RS resource clas
        
        s com.ibm.domino.das.resources.ViewEntryResource with @Path(data/collections/{key}/{value}/unid/{docunid}).
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX
        
        -RS resource class com.ibm.domino.das.resources.DocumentResource with @Path(data/documents/unid/{unid}).
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX
        
        -RS resource class com.ibm.domino.das.resources.ViewEntryCollectionResource with @Path(data/collections/{key}/{value}).
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX
        
        -RS resource class com.ibm.domino.das.resources.ViewCollectionResource with @Path(data/collections).
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX
        
        -RS resource class com.ibm.domino.das.resources.DocumentCollectionResource with @Path(data/documents).
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX
        
        -RS resource class com.ibm.domino.das.resources.DbCollectionResource with @Path(data).
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 213 [Thread-6] INFO org.apache.wink.server.internal.log.Resources - The server has registered the JAX
        
        -RS resource class com.ibm.domino.das.resources.ApiRootResource with @Path().
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 216 [Thread-6] INFO org.apache.wink.server.internal.log.Providers - There are no custom JAX-RS provid
        
        ers defined in the application.
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 436 [Thread-6] INFO org.apache.wink.server.internal.application.ApplicationProcessor - The following
        
        JAX-RS application has been processed: com.ibm.domino.services.mail.service.MailService
        
        [2F6C:000A-1B6C] 19/09/2012 09:02:27   HTTP JVM: 481 [Thread-6] ERROR org.apache.wink.server.internal.RequestProcessor - An unhandled exception occurr
        
        ed which will be propagated to the container.