Converter: TSV/CSV

From OSF Wiki
Jump to: navigation, search
Converter: TSV/CSV endpoint version:
1.1
2

The Converter: TSV Web service is used to convert TSV/CSV data into RDF+XML, RDF+N3, TSV, CSV or XML (the internal OSF Web Service DTD structure), or to convert XML (internal DTD) into TSV or CSV data. In other words, this Web service provides the import and export functionality for the TSV (tab separated values) and CSV (comma separated values), which are common text representations of spreadsheets, among other sources.

All converter Web services endpoints are used to convert multiple kinds of data and to make the bridge between an OSF Web Service and other existing systems that understand these formats.

The TSV and CSV format used by this converter Web service is a three-column file that represent a triple. The first column of the format represents the subject of the triple, the second column the property (or predicate) of the triple and the third column represents the object of the triple.

Developers communicate with the Converter: TSV Web service using the HTTP POST method. You may request one of the following mime types: (1) text/xml, (2) application/rdf+xml, (3) application/rdf+n3, (4) text/tsv or (5) text/csv. The content returned by the Web service is serialized using the mime type requested and the data returned depends on the parameters selected.

Usage

This Web service is intended to be used by content management systems, developers or administrators to manage access to WSF (Web Service Framework) resources (users, datasets, Web services endpoints).

Web Service Endpoint Information

This section describes the permissions you need in the WSF (Web Service Framework) to send a query to this Web service endpoint, and it describes how to access it.

To access this Web service endpoint you need the proper CRUD (Create, Read, Update and Delete) permissions on a specific graph (dataset) of the WSF. Without the proper permissions on this graph you won't be able to send any queries to the endpoint.

Needed registered CRUD permission:
  • Create: False
  • Read: True
  • Update: False
  • Delete: False

On the graph URI:

  • http://[...]/wsf/

Here is the information needed to communicate with this Web service's endpoint. Descriptions of the parameters are included below.

Note: if a parameter has a default value, the requester can omit it and the default value will be used. Also, some baseline Web services may not offer other values than the default.

HTTP method:
  • POST

Possible "Accept:" HTTP header field value:

  • text/xml (DTD validating the returned content)
  • application/rdf+xml
  • application/rdf+n3
  • text/tsv
  • text/csv

URI:

  • http://[...]/ws/converter/tsv/ ?document=param1&docmime=param2&base_uri=param3registered_ip=param4

URI dynamic parameters description:

Note: All parameters have to be URL-encoded

  • param1. Text of the document to convert
  • param2. The requested type of the convertion. One of:
    • "text/tsv (default)": Document formatted in TSV
    • "text/csv (default)": Document formatted in CSV
    • "text/xml": Document formatted in XML with OSF Web Services internal DTD representation
  • param3.The base URI to use to create the URIs of the resources created by this web service
  • param4.Target IP address registered in the WSF. Needed when the IP of the requester is not the one of the one making the request to the endpoint. Otherwise this parameter as to be omitted.

Content Returned

The content returned by the Web service endpoint depends on the "Accept:" parameter sent by the requester. The user can request one of the four supported mime types. The converted content from the input document will be returned by using the requested serialization format.

HTTP Status Codes

Here are the possible HTTP status (error) codes returned by this Web service endpoint.

On error code and the specific error, a different message description can be issued (meaning a different error has been returned).

  • Code:200
    • Message:OK
  • Code:400
    • Message:Bad Request
    • Message description:No data to convert
    • Message description:Document mime not supported (supported mimes: text/tsv, text/csv and text/xml)
    • Message description:No TSV data converted
    • Message description:No requester IP available
    • Message description: No Web service URI available
    • Message description:Target Web service XYZ not registered to this Web Services Framework
    • Message description:No access defined for this requester IP XYZ, dataset (XYZ) and Web service (XYZ)
    • Message description:The target Web service (XYZ) needs create access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
    • Message description:The target Web service (XYZ) needs read access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
    • Message description:The target Web service (XYZ) needs update access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
    • Message description:The target Web service (XYZ) needs delete access and the requested user (XYZ) doesn't have this access for that dataset (XYZ)
  • Code:406
    • Message:Not Acceptable
    • Message description:Unacceptable mime type requested
  • Code:500
    • Message:Internal Error