Archive 2.x:CRUD: Read/2

The CRUD: Read Web service is used to get the description of a target instance record indexed in a dataset belonging to a WSF (Web Services Framework).

Developers communicate with the CRUD: Read Web service using the HTTP GET method. You may request one of the following mime types: (1) text/xml, (2) application/rdf+xml or (3) application/rdf+n3. The content returned by the Web service will be serialized using the mime type requested and the data returned will depend on the parameters selected.

Version
This documentation page is used for the version 2 of this endpoint. Check at the top of this page to see the documentation pages for the other versions of this endpoint.

Usage
This Web service is intended to be used by any user that wants to get the description of an instance record.

Web Service Endpoint Information
This section describes all you 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

As shown on the graph URI:


 * URI of the dataset where the instance record is indexed

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:


 * GET
 * POST

Possible "Accept:" HTTP header field value:


 * text/xml (structXML)
 * application/json (structJSON)
 * application/rdf+xml (RDF+XML)
 * application/rdf+n3 (N3/Turtle)
 * application/iron+json (irJSON)
 * application/iron+csv (commON)

URI:


 * http://[...]/ws/crud/read/ ?uri=param1&dataset=param2&include_linksback=param3&include_reification=param4&include_attributes_list=param5&registered_ip=param6&interface=param7&version=param8&lang=param9

URI dynamic parameters description:

Note: All parameters have to be URL-encoded


 * param1. URI of the instance record. Multiple URIs can be added to this parameter by splitting them with ";". That way, you can get more than one record description by query.
 * param2. (optional) URI of the dataset where the instance record is indexed. If this parameter is omitted (empty), the web service will query all the datasets of the system, that can be read by the requester, to try to find a definition for this record URI. Multiple URIs can be added to this parameter by splitting them with ";".
 * param3. One of:
 * True — Means that the reference to the other instance records referring to the target instance record will be added in the resultset
 * False (default) — No links-back will be added
 * param4. Include possible reification statements for a record. One of:
 * True
 * False (default)
 * param5. (optional) A list of attribute URIs to include into the resultset. Sometime, you may be dealing with datasets where the description of the entities are composed of thousands of attributes/values. Since the Crud: Read web service endpoint returns the complete entities descriptions in its resultsets, this parameter enables you to restrict the attribute/values you want included in the resultset which considerably reduce the size of the resultset to transmit and manipulate.  Multiple attribute URIs can be added to this parameter by splitting them with ";".
 * param6. Target IP address registered in the WSF
 * param7 (optional). Source interface used for this web service query. The interface is a different way to process a query (different algorithms, different data management system, etc. The default interface is 'default'
 * param8 (optional). Version of the source interface that is compatible with this query. If this parameter is omitted, then the latest version of the source interface is used for this query.
 * param9. (default: en) Language of the records to be returned by the search endpoint. Only the textual information of the requested language will be returned to the user. If no textual information is available for a record, for a requested language, then only non-textual information will be returned about the record. The default is "en"; however, if the parameter is an empty string, then all the language strings for the record(s) will be returned.

Available Sources Interfaces
A source interface is a way to process a web service query. Different sources interfaces can be implemented for the same OSF Web Service endpoint. Each interface will process the query differently, but all the queries to the web service endpoint will be the same, at the exception of the  parameter. Each interface shares the same API (the one defined by the web service endpoint), but their processing may differ (like using different algorithms, using different data management systems, etc.)

This is a list of the core interfaces for this endpoint. Organizations that hosts a OSF Web Service network could create their own interface and make it available to the users. However such private source interface won't be part of this list, but should be publicized by the organization.

Versioning
A versioning system exists within OSF Web Service to ensure that distributed users are always accessing viable endpoints with expected behaviors. There are three different kind of versions at various levels within OSF Web Service:


 * 1) Version of the OSF Web Service software package
 * 2) Version of the OSF Web Service web service API endpoint
 * 3) Version of the different source interfaces available for each endpoint

The version of the OSF Web Service software package is only meaningful when a system administrator installs a new OSF Web Service network or when he wants to upgrade an existing OSF Web Service instance. This version has no meaning when it comes time to query any OSF Web Service endpoint.

The version of the OSF Web Service web service API endpoint is the version of the endpoint itself. It is what tracks the changes of the API: so, the changes in terms of parameters of the endpoint (new supported parameters, removed parameters, changes in behaviors for existing parameters). This version is used by the source interfaces to make sure that they are compatible with the web service endpoint's API.

The version of the source interface is the version that should most interest the users of these endpoints. When the user specifies a  for a query, he tells the web service endpoint that the query that is sent is supposed to be compatible with that version of the interface. If the version of the interface has somehow changed in the mean time, an error will be returned and the user will be notified that the query that he is sending is not compatible with the current version of the source interface he is trying to query.

There are five things that can happen with a OSF Web Service endpoint that warrants a change in the version of the endpoint, or one of its source interface:


 * 1) A bug gets fixed (and at least a behavior changes)
 * 2) The code gets refactored (and at least a behavior changes)
 * 3) A new parameter/feature is added to the endpoint (but at least another behavior changed)
 * 4) An existing parameter/feature gets changed, or
 * 5) An existing parameter/feature gets removed.

Example of Returned XML Document
This is an example of the XML document returned by this Web service endpoint for a given dataset URI.

This example returns the description of a dataset registered to a WSF.

Query:


 * http://[...]/ws/crud/read/?dataset=http://[...]/wsf/datasets/46/ &uri=http://bknetwork.org/drupal/bkn/datasets/227/resource/Bob

"Accept:" HTTP header field value:


 * text/xml

Result:

Descriptions of the Types of XML Elements
The elements used to describe an instance record depend on the vocabularies (ontologies) used to describe the instance record in RDF when it was first indexed in the system. Usually more information can be found on the Web for each property and class by creating the full identifier of a property or a class by using the prefix(es) of the XML document.

Example of Returned RDF/XML Document
Here is an example of a RDF/XML document returned by this Web service endpoint for a given URI.

Query<:


 * http://[...]/ws/crud/read/?dataset=http://[...]/wsf/datasets/46/ &uri=http://bknetwork.org/drupal/bkn/datasets/227/resource/Bob

"Accept:" HTTP header field value:


 * application/rdf+xml

Result:

Example of Returned RDF/N3 Document
Here is an example of a RDF/N3 document returned by this Web service endpoint for a given URI.

Query:


 * http://[...]/ws/crud/read/?dataset=http://[...]/wsf/datasets/46/ &uri=http://bknetwork.org/drupal/bkn/datasets/227/resource/Bob

"Accept:" HTTP header field value:


 * application/rdf+n3

Result:

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: This resource is not existing
 * Message description: No URI specified for any resource
 * 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