You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@tika.apache.org by Peter Bowyer <pe...@mapledesign.co.uk> on 2014/12/18 14:58:07 UTC

Outputting JSON from tika-server/meta

Hi,

I suspect this has a really simple answer, but it's eluding me.

How do I get the response from
curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
to be JSON and not CSV?

I've discovered JSONMessageBodyWriter.java (
https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb2501913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWriter.java)
so I think the functionality is present, tried adding --header "Accept:
application/json" to the cURL call, in line with the documentation for
outputting CSV, but no luck so far.

Many thanks,
Peter

RE: Outputting JSON from tika-server/meta

Posted by "Allison, Timothy B." <ta...@mitre.org>.
All,

With many thanks to Sergey, I added JSON and XMP to “/meta” and I folded in MetadataEP into MetadataResource so that users can request a specific metadata value(s). (TIKA-1497, TIKA-1499)

I also added a new endpoint “/rmeta” that is equivalent to tika-app’s –J (TIKA-1498) – JSONified view of a list of metadata objects representing the container document and all embedded docs…aka Jukka and Nick’s RecursiveParserWrapper.

I also updated the jax-rs wiki to reflect these changes.

Please kick the tires and let us know if there are any surprises.

Best,

           Tim
From: Peter Bowyer [mailto:peter@mapledesign.co.uk]
Sent: Thursday, December 18, 2014 8:58 AM
To: user@tika.apache.org
Subject: Outputting JSON from tika-server/meta

Hi,

I suspect this has a really simple answer, but it's eluding me.

How do I get the response from
curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
to be JSON and not CSV?

I've discovered JSONMessageBodyWriter.java (https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb2501913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWriter.java) so I think the functionality is present, tried adding --header "Accept: application/json" to the cURL call, in line with the documentation for outputting CSV, but no luck so far.

Many thanks,
Peter

RE: Outputting JSON from tika-server/meta

Posted by "Allison, Timothy B." <ta...@mitre.org>.
Ha, yes, that is on my ever growing list of todos.  That is slightly different, though, from metadata so I’d want to add a separate endpoint.

Does the format you get with the –J option on tika-app from 1.7-SNAPSHOT work for you?



From: Peter Bowyer [mailto:peter@mapledesign.co.uk]
Sent: Thursday, December 18, 2014 10:53 AM
To: user@tika.apache.org
Subject: Re: Outputting JSON from tika-server/meta

If the API is being modified, could we add an endpoint which will return a combined JSON output, like:
{
   "meta" : { ... },
   "content" : { "string of content" }
}

This would save me making two API calls, fetching each individually and loading the document twice. /unpack does something similar, but returns a single file.

Peter

On 18 December 2014 at 15:42, Chris Mattmann <ch...@gmail.com>> wrote:
Yeah I think we should probably combine them..and make
JSON the default (which unfortunately would break back
compat, but in my mind would make a lot more sense)

------------------------
Chris Mattmann
chris.mattmann@gmail.com<ma...@gmail.com>




-----Original Message-----
From: "Allison, Timothy B." <ta...@mitre.org>>
Reply-To: <us...@tika.apache.org>>
Date: Thursday, December 18, 2014 at 7:20 AM
To: "user@tika.apache.org<ma...@tika.apache.org>" <us...@tika.apache.org>>
Subject: RE: Outputting JSON from tika-server/meta

>Do you have any luck if you call /metadata instead of /meta?
>
>That should trigger MetadataEP which will return Json, no?
>
>I'm not sure why we have both handlers, but we do...
>
>
>-----Original Message-----
>From: Sergey Beryozkin [mailto:sberyozkin@gmail.com<ma...@gmail.com>]
>Sent: Thursday, December 18, 2014 9:56 AM
>To: user@tika.apache.org<ma...@tika.apache.org>
>Subject: Re: Outputting JSON from tika-server/meta
>
>Hi Peter
>Thanks, you are too nice, it is a minor bug :-)
>Cheers, Sergey
>On 18/12/14 14:50, Peter Bowyer wrote:
>> Thanks Sergey, I have opened TIKA-1497 for this enhancement.
>>
>> Best wishes,
>> Peter
>>
>> On 18 December 2014 at 14:31, Sergey Beryozkin <sb...@gmail.com>
>> <ma...@gmail.com>>> wrote:
>>
>>     Hi,
>>     I see MetadataResource returning StreamingOutput and it has
>>     @Produces(text/csv) only. As such this MBW has no effect at the
>>moment.
>>
>>     We can update MetadataResource to return Metadata directly if
>>     application/json is requested or update MetadataResource to directly
>>     convert Metadata to JSON in case of JSON being accepted
>>
>>     Can you please open a JIRA issue ?
>>
>>     Cheers, Sergey
>>
>>
>>
>>     On 18/12/14 13:58, Peter Bowyer wrote:
>>
>>         Hi,
>>
>>         I suspect this has a really simple answer, but it's eluding me.
>>
>>         How do I get the response from
>>         curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
>>         to be JSON and not CSV?
>>
>>         I've discovered JSONMessageBodyWriter.java
>>
>>(https://github.com/apache/__tika/blob/__af19f3ea04792cad81b428f1df9f5e__
>>bbb2501913/tika-server/src/__main/java/org/apache/tika/__server/JSONMessa
>>geBodyWriter.__java
>>
>><https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb250
>>1913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWrit
>>er.java>)
>>         so I think the functionality is present, tried adding --header
>>         "Accept:
>>         application/json" to the cURL call, in line with the
>>         documentation for
>>         outputting CSV, but no luck so far.
>>
>>         Many thanks,
>>         Peter
>>
>>
>>
>>
>> --
>> Maple Design Ltd
>> http://www.mapledesign.co.uk
>> <http://www.mapledesign.co.uk/>+44 (0)845 123 8008<tel:%2B44%20%280%29845%20123%208008>
>>
>> Reg. in England no. 05920531
>
>



--
Maple Design Ltd
http://www.mapledesign.co.uk
<http://www.mapledesign.co.uk/>+44 (0)845 123 8008

Reg. in England no. 05920531

Re: Outputting JSON from tika-server/meta

Posted by Peter Bowyer <pe...@mapledesign.co.uk>.
If the API is being modified, could we add an endpoint which will return a
combined JSON output, like:
{
   "meta" : { ... },
   "content" : { "string of content" }
}

This would save me making two API calls, fetching each individually and
loading the document twice. /unpack does something similar, but returns a
single file.

Peter

On 18 December 2014 at 15:42, Chris Mattmann <ch...@gmail.com>
wrote:
>
> Yeah I think we should probably combine them..and make
> JSON the default (which unfortunately would break back
> compat, but in my mind would make a lot more sense)
>
> ------------------------
> Chris Mattmann
> chris.mattmann@gmail.com
>
>
>
>
> -----Original Message-----
> From: "Allison, Timothy B." <ta...@mitre.org>
> Reply-To: <us...@tika.apache.org>
> Date: Thursday, December 18, 2014 at 7:20 AM
> To: "user@tika.apache.org" <us...@tika.apache.org>
> Subject: RE: Outputting JSON from tika-server/meta
>
> >Do you have any luck if you call /metadata instead of /meta?
> >
> >That should trigger MetadataEP which will return Json, no?
> >
> >I'm not sure why we have both handlers, but we do...
> >
> >
> >-----Original Message-----
> >From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
> >Sent: Thursday, December 18, 2014 9:56 AM
> >To: user@tika.apache.org
> >Subject: Re: Outputting JSON from tika-server/meta
> >
> >Hi Peter
> >Thanks, you are too nice, it is a minor bug :-)
> >Cheers, Sergey
> >On 18/12/14 14:50, Peter Bowyer wrote:
> >> Thanks Sergey, I have opened TIKA-1497 for this enhancement.
> >>
> >> Best wishes,
> >> Peter
> >>
> >> On 18 December 2014 at 14:31, Sergey Beryozkin <sberyozkin@gmail.com
> >> <ma...@gmail.com>> wrote:
> >>
> >>     Hi,
> >>     I see MetadataResource returning StreamingOutput and it has
> >>     @Produces(text/csv) only. As such this MBW has no effect at the
> >>moment.
> >>
> >>     We can update MetadataResource to return Metadata directly if
> >>     application/json is requested or update MetadataResource to directly
> >>     convert Metadata to JSON in case of JSON being accepted
> >>
> >>     Can you please open a JIRA issue ?
> >>
> >>     Cheers, Sergey
> >>
> >>
> >>
> >>     On 18/12/14 13:58, Peter Bowyer wrote:
> >>
> >>         Hi,
> >>
> >>         I suspect this has a really simple answer, but it's eluding me.
> >>
> >>         How do I get the response from
> >>         curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
> >>         to be JSON and not CSV?
> >>
> >>         I've discovered JSONMessageBodyWriter.java
> >>
> >>(
> https://github.com/apache/__tika/blob/__af19f3ea04792cad81b428f1df9f5e__
> >>bbb2501913/tika-server/src/__main/java/org/apache/tika/__server/JSONMessa
> >>geBodyWriter.__java
> >>
> >><
> https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb250
> >>1913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWrit
> >>er.java>)
> >>         so I think the functionality is present, tried adding --header
> >>         "Accept:
> >>         application/json" to the cURL call, in line with the
> >>         documentation for
> >>         outputting CSV, but no luck so far.
> >>
> >>         Many thanks,
> >>         Peter
> >>
> >>
> >>
> >>
> >> --
> >> Maple Design Ltd
> >> http://www.mapledesign.co.uk
> >> <http://www.mapledesign.co.uk/>+44 (0)845 123 8008
> >>
> >> Reg. in England no. 05920531
> >
> >
>
>
>

-- 
Maple Design Ltd
http://www.mapledesign.co.uk
+44 (0)845 123 8008

Reg. in England no. 05920531

Re: Outputting JSON from tika-server/meta

Posted by Chris Mattmann <ch...@gmail.com>.
Yeah I think we should probably combine them..and make
JSON the default (which unfortunately would break back
compat, but in my mind would make a lot more sense)

------------------------
Chris Mattmann
chris.mattmann@gmail.com




-----Original Message-----
From: "Allison, Timothy B." <ta...@mitre.org>
Reply-To: <us...@tika.apache.org>
Date: Thursday, December 18, 2014 at 7:20 AM
To: "user@tika.apache.org" <us...@tika.apache.org>
Subject: RE: Outputting JSON from tika-server/meta

>Do you have any luck if you call /metadata instead of /meta?
>
>That should trigger MetadataEP which will return Json, no?
>
>I'm not sure why we have both handlers, but we do...
>
>
>-----Original Message-----
>From: Sergey Beryozkin [mailto:sberyozkin@gmail.com]
>Sent: Thursday, December 18, 2014 9:56 AM
>To: user@tika.apache.org
>Subject: Re: Outputting JSON from tika-server/meta
>
>Hi Peter
>Thanks, you are too nice, it is a minor bug :-)
>Cheers, Sergey
>On 18/12/14 14:50, Peter Bowyer wrote:
>> Thanks Sergey, I have opened TIKA-1497 for this enhancement.
>>
>> Best wishes,
>> Peter
>>
>> On 18 December 2014 at 14:31, Sergey Beryozkin <sberyozkin@gmail.com
>> <ma...@gmail.com>> wrote:
>>
>>     Hi,
>>     I see MetadataResource returning StreamingOutput and it has
>>     @Produces(text/csv) only. As such this MBW has no effect at the
>>moment.
>>
>>     We can update MetadataResource to return Metadata directly if
>>     application/json is requested or update MetadataResource to directly
>>     convert Metadata to JSON in case of JSON being accepted
>>
>>     Can you please open a JIRA issue ?
>>
>>     Cheers, Sergey
>>
>>
>>
>>     On 18/12/14 13:58, Peter Bowyer wrote:
>>
>>         Hi,
>>
>>         I suspect this has a really simple answer, but it's eluding me.
>>
>>         How do I get the response from
>>         curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
>>         to be JSON and not CSV?
>>
>>         I've discovered JSONMessageBodyWriter.java
>>         
>>(https://github.com/apache/__tika/blob/__af19f3ea04792cad81b428f1df9f5e__
>>bbb2501913/tika-server/src/__main/java/org/apache/tika/__server/JSONMessa
>>geBodyWriter.__java
>>         
>><https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb250
>>1913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWrit
>>er.java>)
>>         so I think the functionality is present, tried adding --header
>>         "Accept:
>>         application/json" to the cURL call, in line with the
>>         documentation for
>>         outputting CSV, but no luck so far.
>>
>>         Many thanks,
>>         Peter
>>
>>
>>
>>
>> --
>> Maple Design Ltd
>> http://www.mapledesign.co.uk
>> <http://www.mapledesign.co.uk/>+44 (0)845 123 8008
>>
>> Reg. in England no. 05920531
>
>



RE: Outputting JSON from tika-server/meta

Posted by "Allison, Timothy B." <ta...@mitre.org>.
Doh!  K, looks like we aren’t loading that in TikaServerCLI.

Does anyone know how we’re using MetadataEP?

From: Peter Bowyer [mailto:peter@mapledesign.co.uk]
Sent: Thursday, December 18, 2014 10:57 AM
To: user@tika.apache.org
Subject: Re: Outputting JSON from tika-server/meta

On 18 December 2014 at 15:20, Allison, Timothy B. <ta...@mitre.org>> wrote:
Do you have any luck if you call /metadata instead of /meta?

I have no luck with that:

Dec 18, 2014 3:55:21 PM org.apache.cxf.jaxrs.utils.JAXRSUtils findTargetMethod
WARNING: No operation matching request path "/metadata" is found, Relative Path: /metadata, HTTP Method: PUT, ContentType: */*, Accept: */*,. Please enable FINE/TRACE log level for more details.
Dec 18, 2014 3:55:21 PM org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: javax.ws.rs.ClientErrorException: HTTP 404 Not Found
        at org.apache.cxf.jaxrs.utils.SpecExceptions.toHttpException(SpecExceptions.java:117)
        at org.apache.cxf.jaxrs.utils.ExceptionUtils.toHttpException(ExceptionUtils.java:157)
        at org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:526)
        at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:177)
        at org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:77)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
        at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
        at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:243)
        at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:261)
        at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:370)
        at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
        at org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
        at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:651)
        at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:745)

Best regards,
Peter

Re: Outputting JSON from tika-server/meta

Posted by Peter Bowyer <pe...@mapledesign.co.uk>.
On 18 December 2014 at 15:20, Allison, Timothy B. <ta...@mitre.org>
wrote:
>
> Do you have any luck if you call /metadata instead of /meta?
>

I have no luck with that:

Dec 18, 2014 3:55:21 PM org.apache.cxf.jaxrs.utils.JAXRSUtils
findTargetMethod
WARNING: No operation matching request path "/metadata" is found, Relative
Path: /metadata, HTTP Method: PUT, ContentType: */*, Accept: */*,. Please
enable FINE/TRACE log level for more details.
Dec 18, 2014 3:55:21 PM
org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper toResponse
WARNING: javax.ws.rs.ClientErrorException: HTTP 404 Not Found
        at
org.apache.cxf.jaxrs.utils.SpecExceptions.toHttpException(SpecExceptions.java:117)
        at
org.apache.cxf.jaxrs.utils.ExceptionUtils.toHttpException(ExceptionUtils.java:157)
        at
org.apache.cxf.jaxrs.utils.JAXRSUtils.findTargetMethod(JAXRSUtils.java:526)
        at
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.processRequest(JAXRSInInterceptor.java:177)
        at
org.apache.cxf.jaxrs.interceptor.JAXRSInInterceptor.handleMessage(JAXRSInInterceptor.java:77)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
        at
org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
        at
org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:243)
        at
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(JettyHTTPDestination.java:261)
        at
org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(JettyHTTPHandler.java:70)
        at
org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1088)
        at
org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1024)
        at
org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
        at
org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:255)
        at
org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
        at org.eclipse.jetty.server.Server.handle(Server.java:370)
        at
org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:494)
        at
org.eclipse.jetty.server.AbstractHttpConnection.headerComplete(AbstractHttpConnection.java:971)
        at
org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:1033)
        at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:651)
        at
org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:235)
        at
org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:696)
        at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:53)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
        at
org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
        at java.lang.Thread.run(Thread.java:745)

Best regards,
Peter

RE: Outputting JSON from tika-server/meta

Posted by "Allison, Timothy B." <ta...@mitre.org>.
Do you have any luck if you call /metadata instead of /meta?

That should trigger MetadataEP which will return Json, no?

I'm not sure why we have both handlers, but we do...


-----Original Message-----
From: Sergey Beryozkin [mailto:sberyozkin@gmail.com] 
Sent: Thursday, December 18, 2014 9:56 AM
To: user@tika.apache.org
Subject: Re: Outputting JSON from tika-server/meta

Hi Peter
Thanks, you are too nice, it is a minor bug :-)
Cheers, Sergey
On 18/12/14 14:50, Peter Bowyer wrote:
> Thanks Sergey, I have opened TIKA-1497 for this enhancement.
>
> Best wishes,
> Peter
>
> On 18 December 2014 at 14:31, Sergey Beryozkin <sberyozkin@gmail.com
> <ma...@gmail.com>> wrote:
>
>     Hi,
>     I see MetadataResource returning StreamingOutput and it has
>     @Produces(text/csv) only. As such this MBW has no effect at the moment.
>
>     We can update MetadataResource to return Metadata directly if
>     application/json is requested or update MetadataResource to directly
>     convert Metadata to JSON in case of JSON being accepted
>
>     Can you please open a JIRA issue ?
>
>     Cheers, Sergey
>
>
>
>     On 18/12/14 13:58, Peter Bowyer wrote:
>
>         Hi,
>
>         I suspect this has a really simple answer, but it's eluding me.
>
>         How do I get the response from
>         curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
>         to be JSON and not CSV?
>
>         I've discovered JSONMessageBodyWriter.java
>         (https://github.com/apache/__tika/blob/__af19f3ea04792cad81b428f1df9f5e__bbb2501913/tika-server/src/__main/java/org/apache/tika/__server/JSONMessageBodyWriter.__java
>         <https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb2501913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWriter.java>)
>         so I think the functionality is present, tried adding --header
>         "Accept:
>         application/json" to the cURL call, in line with the
>         documentation for
>         outputting CSV, but no luck so far.
>
>         Many thanks,
>         Peter
>
>
>
>
> --
> Maple Design Ltd
> http://www.mapledesign.co.uk
> <http://www.mapledesign.co.uk/>+44 (0)845 123 8008
>
> Reg. in England no. 05920531



Re: Outputting JSON from tika-server/meta

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi Peter
Thanks, you are too nice, it is a minor bug :-)
Cheers, Sergey
On 18/12/14 14:50, Peter Bowyer wrote:
> Thanks Sergey, I have opened TIKA-1497 for this enhancement.
>
> Best wishes,
> Peter
>
> On 18 December 2014 at 14:31, Sergey Beryozkin <sberyozkin@gmail.com
> <ma...@gmail.com>> wrote:
>
>     Hi,
>     I see MetadataResource returning StreamingOutput and it has
>     @Produces(text/csv) only. As such this MBW has no effect at the moment.
>
>     We can update MetadataResource to return Metadata directly if
>     application/json is requested or update MetadataResource to directly
>     convert Metadata to JSON in case of JSON being accepted
>
>     Can you please open a JIRA issue ?
>
>     Cheers, Sergey
>
>
>
>     On 18/12/14 13:58, Peter Bowyer wrote:
>
>         Hi,
>
>         I suspect this has a really simple answer, but it's eluding me.
>
>         How do I get the response from
>         curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
>         to be JSON and not CSV?
>
>         I've discovered JSONMessageBodyWriter.java
>         (https://github.com/apache/__tika/blob/__af19f3ea04792cad81b428f1df9f5e__bbb2501913/tika-server/src/__main/java/org/apache/tika/__server/JSONMessageBodyWriter.__java
>         <https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb2501913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWriter.java>)
>         so I think the functionality is present, tried adding --header
>         "Accept:
>         application/json" to the cURL call, in line with the
>         documentation for
>         outputting CSV, but no luck so far.
>
>         Many thanks,
>         Peter
>
>
>
>
> --
> Maple Design Ltd
> http://www.mapledesign.co.uk
> <http://www.mapledesign.co.uk/>+44 (0)845 123 8008
>
> Reg. in England no. 05920531



Re: Outputting JSON from tika-server/meta

Posted by Peter Bowyer <pe...@mapledesign.co.uk>.
Thanks Sergey, I have opened TIKA-1497 for this enhancement.

Best wishes,
Peter

On 18 December 2014 at 14:31, Sergey Beryozkin <sb...@gmail.com> wrote:
>
> Hi,
> I see MetadataResource returning StreamingOutput and it has
> @Produces(text/csv) only. As such this MBW has no effect at the moment.
>
> We can update MetadataResource to return Metadata directly if
> application/json is requested or update MetadataResource to directly
> convert Metadata to JSON in case of JSON being accepted
>
> Can you please open a JIRA issue ?
>
> Cheers, Sergey
>
>
>
> On 18/12/14 13:58, Peter Bowyer wrote:
>
>> Hi,
>>
>> I suspect this has a really simple answer, but it's eluding me.
>>
>> How do I get the response from
>> curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
>> to be JSON and not CSV?
>>
>> I've discovered JSONMessageBodyWriter.java
>> (https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5e
>> bbb2501913/tika-server/src/main/java/org/apache/tika/
>> server/JSONMessageBodyWriter.java)
>> so I think the functionality is present, tried adding --header "Accept:
>> application/json" to the cURL call, in line with the documentation for
>> outputting CSV, but no luck so far.
>>
>> Many thanks,
>> Peter
>>
>
>

-- 
Maple Design Ltd
http://www.mapledesign.co.uk
+44 (0)845 123 8008

Reg. in England no. 05920531

Re: Outputting JSON from tika-server/meta

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi,
I see MetadataResource returning StreamingOutput and it has 
@Produces(text/csv) only. As such this MBW has no effect at the moment.

We can update MetadataResource to return Metadata directly if 
application/json is requested or update MetadataResource to directly 
convert Metadata to JSON in case of JSON being accepted

Can you please open a JIRA issue ?

Cheers, Sergey


On 18/12/14 13:58, Peter Bowyer wrote:
> Hi,
>
> I suspect this has a really simple answer, but it's eluding me.
>
> How do I get the response from
> curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
> to be JSON and not CSV?
>
> I've discovered JSONMessageBodyWriter.java
> (https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb2501913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWriter.java)
> so I think the functionality is present, tried adding --header "Accept:
> application/json" to the cURL call, in line with the documentation for
> outputting CSV, but no luck so far.
>
> Many thanks,
> Peter


RE: Outputting JSON from tika-server/meta

Posted by "Allison, Timothy B." <ta...@mitre.org>.
All,

With many thanks to Sergey, I added JSON and XMP to “/meta” and I folded in MetadataEP into MetadataResource so that users can request a specific metadata value(s). (TIKA-1497, TIKA-1499)

I also added a new endpoint “/rmeta” that is equivalent to tika-app’s –J (TIKA-1498) – JSONified view of a list of metadata objects representing the container document and all embedded docs…aka Jukka and Nick’s RecursiveParserWrapper.

I also updated the jax-rs wiki to reflect these changes.

Please kick the tires and let us know if there are any surprises.

Best,

           Tim
From: Peter Bowyer [mailto:peter@mapledesign.co.uk]
Sent: Thursday, December 18, 2014 8:58 AM
To: user@tika.apache.org
Subject: Outputting JSON from tika-server/meta

Hi,

I suspect this has a really simple answer, but it's eluding me.

How do I get the response from
curl -X PUT -T /path/to/file.pdf http://localhost:9998/meta
to be JSON and not CSV?

I've discovered JSONMessageBodyWriter.java (https://github.com/apache/tika/blob/af19f3ea04792cad81b428f1df9f5ebbb2501913/tika-server/src/main/java/org/apache/tika/server/JSONMessageBodyWriter.java) so I think the functionality is present, tried adding --header "Accept: application/json" to the cURL call, in line with the documentation for outputting CSV, but no luck so far.

Many thanks,
Peter