Skip to content

Latest commit

 

History

History
264 lines (229 loc) · 6.23 KB

notice.md

File metadata and controls

264 lines (229 loc) · 6.23 KB

home #The Gazette Notice # Notice content can be retrieved using following URIs, content will be for a particular notice (notice-id). The user can optionally be registered for this endpoint, being authenticated will allow users to retrieve their unpublished notices. To be authenticated users must register and then sign-in.

Other related endpoints which give further information about the notice:

Resource URL

/notice/{notice-id}

Valid notice Ids for published notices can be found using:

Ids for the user's own unpublished notices can be found using:

Alternative Representations

Due to the large number of alternative representations available there is a notes column to help guide the user to the appropriate representation.

Representation URI Method Response type Notes
​​/notice/{notice-id}
/notice/{notice-id}/data.htm
GET (X)HTML5+RDFa Website view of the notice with all of the page chrome included.
/notice/{notice-id}/data.xml (X)HTML5+RDFa Contains only the notice of the content
/notice/{notice-id}/data.pdf PDF PDF of the notice specified, compare to page and issue
/notice/{notice-id}/data.ttl TTL
​​/notice/{notice-id}/data.rdf RDF
/notice/{notice-id}/data.jsonld JSON LD
/notice/{notice-id}?view=linked-data HTML
​​​​/notice/{notice-id}data.ttl?view=linked-data TTL
​​​​/notice/{notice-id}data.rdf?view=linked-data RDF/XML
​​/notice/{notice-id}data.rdfjson?view=linked-data RDF/JSON
/notice/{notice-id}data.json?view=linked-data JSON LD
​​/notice/{notice-id}data.xml?view=linked-data XML Linked data xml view containing the only data elements of the notice

Content Negotiation

Generic Document URI Method Accept header​ Response type Matching Representation*
/notice/{notice-id} GET application/ld+json JSON LD
​application/rdf+xml ​RDF
text/turtle ​TTL
application/xml (X)HTML5+RDFa /notice/{notice-id}/data.xml
text/html (X)HTML5+RDFa /notice/{notice-id}
/notice/{notice-id}/data.htm
*/*
/notice/{notice-id}?view=linked-data ​application/rdf+xml RDF/XML
​application/rdf+json RDF/JSON
text/turtle TTL
application/json JSON
​application/xml XML
​text/html HTML
*/*
*\*Only included where the response type is otherwise ambiguous* ## Parameters ##
view Only one value is allowable linked-data this switches the responses to be a Linked-Data API view, this will contain the data elements of the notice.
Example Values: linked-data

Code Samples

java

// with accept header
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
public class RestClient {
	public static void main(String args[])
	{
		// get the access token via POST explained in Sign-in document.
	   	RestAssured.baseURI = "https://www.thegazette.co.uk";
	   	
	   	Response response = given().header("Authorization", "Bearer " + accessToken).header("Accept", "application/rdf+xml").expect().statusCode(200).get("/notice/{notice-id}");
		String asString = response.getBody().asString();
    }

}

// without accept header
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
public class RestClient {
	public static void main(String args[])
	{
		// get the access token via POST explained in Sign-in document.
	   	RestAssured.baseURI = "https://www.thegazette.co.uk";

    	Response response = given().expect().statusCode(200).get("/notice/{notice-id}");
		String asString = response.getBody().asString();
    }

}

php

<?php
	//$noticeId should be set to the notice Id to be retrieved
	$noticeURI = "https://www.thegazette.co.uk/notice/" + $noticeId;

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL,				$noticeURI);
	curl_setopt($ch, CURLOPT_RETURNTRANSFER,	true);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,	false);
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,	false);
	curl_setopt($ch, CURLOPT_FOLLOWLOCATION,	false);
	$noticeContent = curl_exec($ch);
	
	curl_close($ch);
	if($noticeContent){
		print $noticeContent;
	}
?>

javascript

without external libraries

//noticeId should be set to the notice Id to be retrieved	    
var xmlhttp, noticeId;
	
xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function() {
   if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
        document.getElementById("bodyID").innerHTML = xmlhttp.responseText;
    }
}

xmlhttp.open("GET", "https://www.thegazette.co.uk/notice/" + noticeId, true);
xmlhttp.send();

with jQuery

$.ajax({
    url: "https://www.thegazette.co.uk/notice/" + noticeId,
    context: document.body
});