Commit da6a5802 authored by Matija Obreza's avatar Matija Obreza

Documentation: Migrating to API v1 and more

- Updated API URL to https://api.*
- BrAPI: set germplasmPUI
parent fb418b1b
This diff is collapsed.
......@@ -82,7 +82,7 @@ To add images to an accession you must first upload the image to Genesys with a
[source,bash]
----
$ curl 'https://sandbox.genesys-pgr.org/api/v0/img/XXX001/acn/ACC001/?originalFilename=IMG0012.jpg' -i -X PUT -H 'Content-Type: image/jpeg' -d @path/to/IMG0012.jpg
$ curl 'https://api.sandbox.genesys-pgr.org/api/v0/img/XXX001/acn/ACC001/?originalFilename=IMG0012.jpg' -i -X PUT -H 'Content-Type: image/jpeg' -d @path/to/IMG0012.jpg
----
The request `Content-Type` header must be set to the image content type (e.g.
......
......@@ -53,7 +53,7 @@ initiated by opening the authorization URL in a browser (please substitute `CLIE
with valid data):
----
https://sandbox.genesys-pgr.org/oauth/authorize?client_id=CLIENTID&client_secret=SECRET&response_type=code&redirect_uri=oob&scope=write
https://api.sandbox.genesys-pgr.org/oauth/authorize?client_id=CLIENTID&client_secret=SECRET&response_type=code&redirect_uri=oob&scope=write
----
The server will prompt you to authorize the access to your protected resources on Genesys.
......@@ -61,7 +61,7 @@ After your confirmation, the server will present an authorization code (which wi
From a shell, execute the following `curl` command, with your authorization code in place of `THECODE`:
----
$ curl 'https://sandbox.genesys-pgr.org/oauth/token?grant_type=authorization_code&client_id=CLIENTID&client_secret=SECRET&redirect_uri=oob&code=THECODE'
$ curl 'https://api.sandbox.genesys-pgr.org/oauth/token?grant_type=authorization_code&client_id=CLIENTID&client_secret=SECRET&redirect_uri=oob&code=THECODE'
----
==== Username and password
......@@ -71,7 +71,7 @@ applications) where the user's password will not be captured or stored -- i.e.
it will be used once. A password grant can be used as follows:
----
$ curl 'https://sandbox.genesys-pgr.org/oauth/token' --data 'scope=write+read&grant_type=password&username=USERNAME&password=PASSWORD&client_id=CLIENT_ID&client_secret=CLIENT_SECRET'
$ curl 'https://api.sandbox.genesys-pgr.org/oauth/token' --data 'scope=write+read&grant_type=password&username=USERNAME&password=PASSWORD&client_id=CLIENT_ID&client_secret=CLIENT_SECRET'
----
==== Client credentials
......@@ -93,7 +93,7 @@ To obtain a valid (but short-lived) access token, a simple `POST` request to
Genesys is required:
----
$ curl -X POST 'https://sandbox.genesys-pgr.org/oauth/token?grant_type=client_credentials&client_id=CLIENTID&client_secret=SECRET&redirect_uri=oob'
$ curl -X POST 'https://api.sandbox.genesys-pgr.org/oauth/token?grant_type=client_credentials&client_id=CLIENTID&client_secret=SECRET&redirect_uri=oob'
----
This type of grant takes out the *user* authentication and authenticates the
......@@ -132,7 +132,7 @@ or by including it in the request URL as a query string parameter:
[source,bash]
----
$ curl 'https://sandbox.genesys-pgr.org/api/v0/me?access_token=OAUTH-ACCESS-TOKEN'
$ curl 'https://api.sandbox.genesys-pgr.org/api/v0/me?access_token=OAUTH-ACCESS-TOKEN'
----
=== Using the refresh token
......@@ -156,7 +156,7 @@ The refresh token must be securely persisted and can be used to request a new ac
when the previous access token expires:
----
$ curl 'https://sandbox.genesys-pgr.org/oauth/token?grant_type=refresh_token&client_id=CLIENTID&client_secret=SECRET&redirect_uri=oob&refresh_token=OAUTH-REFRESH-TOKEN'
$ curl 'https://api.sandbox.genesys-pgr.org/oauth/token?grant_type=refresh_token&client_id=CLIENTID&client_secret=SECRET&redirect_uri=oob&refresh_token=OAUTH-REFRESH-TOKEN'
----
......
......@@ -13,9 +13,9 @@ December 2015: Documentation commit {buildNumber}
All API access is over HTTPS, and accessed from the https://www.genesys-pgr.org domain or
through https://sandbox.genesys-pgr.org for testing purposes. All data is sent and received as JSON.
In this manual, all URLs are pointing to the Genesys sandbox environment at https://sandbox.genesys-pgr.org.
All API access is over HTTPS, and accessed from the https://api.genesys-pgr.org domain or
through https://api.sandbox.genesys-pgr.org for testing purposes. All data is sent and received as JSON.
In this manual, all URLs are pointing to the Genesys sandbox environment at https://api.sandbox.genesys-pgr.org.
include::api/security.adoc[]
......
......@@ -14,9 +14,9 @@ March 2017: Documentation commit {buildNumber}
Genesys implements basic <<brapiv1, BrAPI v1 specification>>
All API access is over HTTPS, and accessed from the https://www.genesys-pgr.org domain or
through https://sandbox.genesys-pgr.org for testing purposes. All data is sent and received as JSON.
In this manual, all URLs are pointing to the Genesys sandbox environment at https://sandbox.genesys-pgr.org.
All API access is over HTTPS, and accessed from the https://api.genesys-pgr.org domain or
through https://api.sandbox.genesys-pgr.org for testing purposes. All data is sent and received as JSON.
In this manual, all URLs are pointing to the Genesys sandbox environment at https://api.sandbox.genesys-pgr.org.
include::brapi/auth.adoc[]
......
......@@ -10,7 +10,8 @@ Authorization: Bearer <TOKEN>
=== Login
Genesys does not support the `/login` endpoint.
Genesys does not support the `/login` endpoint. You must obtain the OAuth access token as described
in Genesys API manual.
=== Logout
......
......@@ -34,7 +34,7 @@ Genesys returns the standard BrAPI Germplasm response:
},
"result": <1> [{
"defaultDisplayName": "DJUG 16",
"germplasmPUI": null,
"germplasmPUI": "10.0000/ABCD*",
"pedigree": null,
"seedSource": null,
"synonyms": ["DJUG 16"],
......
......@@ -46,6 +46,7 @@ public class BrAPIServiceImpl implements BrAPIService {
Germplasm g = new Germplasm();
g.setUuid(accession.getUuid());
g.setGermplasmPUI(accession.getDoi());
g.setAcceNumb(accession.getAccessionNumber());
g.setDefaultDisplayName(accession.getAccessionNumber());
g.setAcceName(accession.getAccessionNumber());
......
......@@ -138,7 +138,7 @@ public class AccessionControllerTest extends AbstractApiTest {
public void beforeTest() throws Exception {
super.beforeTest();
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost(
"sandbox.genesys-pgr.org").withPort(443)).build();
"api.sandbox.genesys-pgr.org").withPort(443)).build();
institute = new FaoInstitute();
institute.setCode("INS001");
institute.setFullName("An institute");
......
......@@ -92,7 +92,7 @@ public class CropsControllerTest extends AbstractApiTest {
super.beforeTest();
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(documentationConfiguration(this.restDocumentation).uris()
.withScheme("https")
.withHost("sandbox.genesys-pgr.org")
.withHost("api.sandbox.genesys-pgr.org")
.withPort(443)).build();
crop = cropService.addCrop("maize", "Maize", "Crop description in EN", null);
......
......@@ -84,7 +84,7 @@ public class ApiCropsTest extends AbstractApiTest {
@Before
public void setUp() {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("sandbox.genesys-pgr.org").withPort(443)).build();
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("api.sandbox.genesys-pgr.org").withPort(443)).build();
crop = cropService.addCrop("maize", "Maize", "Crop description in EN", null);
assertThat(crop.getId(), greaterThan(0l));
......
......@@ -117,7 +117,7 @@ public class ApiImagesDocsTest extends AbstractApiTest {
@Before
public void setUp() throws InterruptedException {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("sandbox.genesys-pgr.org").withPort(443)).build();
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("api.sandbox.genesys-pgr.org").withPort(443)).build();
List<FaoInstitute> institutes = new ArrayList<>();
institute = new FaoInstitute();
......
......@@ -72,7 +72,7 @@ public class ApiRequestsDocsTest extends AbstractApiTest {
@Before
public void setUp() {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("sandbox.genesys-pgr.org").withPort(443)).build();
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("api.sandbox.genesys-pgr.org").withPort(443)).build();
Collection<FaoInstitute> institutes = new ArrayList<>();
institute = new FaoInstitute();
......
......@@ -81,7 +81,7 @@ public class BrAPITest extends AbstractApiTest {
@Before
public void setUp() {
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("sandbox.genesys-pgr.org").withPort(443)).build();
.apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost("api.sandbox.genesys-pgr.org").withPort(443)).build();
crop = cropService.addCrop("maize", "Maize", "Crop description in EN", null);
assertThat(crop.getId(), greaterThan(0l));
......
......@@ -135,7 +135,7 @@ public class AccessionControllerTest extends AbstractApiTest {
public void beforeTest() throws Exception {
super.beforeTest();
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost(
"sandbox.genesys-pgr.org").withPort(443)).build();
"api.sandbox.genesys-pgr.org").withPort(443)).build();
institute = new FaoInstitute();
institute.setCode("INS001");
institute.setFullName("An institute");
......
......@@ -64,7 +64,7 @@ public class AsciiDocControllerTest extends AbstractApiTest {
/*@formatter:off*/
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext)
.apply(documentationConfiguration(this.restDocumentation)
.uris().withScheme("https").withHost("sandbox.genesys-pgr.org").withPort(443))
.uris().withScheme("https").withHost("api.sandbox.genesys-pgr.org").withPort(443))
.build();
/*@formatter:on*/
......
......@@ -107,7 +107,7 @@ public class CropsControllerTest extends AbstractApiTest {
super.beforeTest();
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(documentationConfiguration(this.restDocumentation).uris()
.withScheme("https")
.withHost("sandbox.genesys-pgr.org")
.withHost("api.sandbox.genesys-pgr.org")
.withPort(443)).build();
crop = cropService.addCrop("maize", "Maize", "Crop description in EN", null);
......
......@@ -78,7 +78,7 @@ public class UserRegistrationControllerTest extends AbstractApiTest {
public void beforeTest() throws Exception {
super.beforeTest();
mockMvc = MockMvcBuilders.webAppContextSetup(webApplicationContext).apply(documentationConfiguration(this.restDocumentation).uris().withScheme("https").withHost(
"sandbox.genesys-pgr.org").withPort(443)).build();
"api.sandbox.genesys-pgr.org").withPort(443)).build();
}
@Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment