version 2.3
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.
1. Security
Access to selected resources in Genesys is protected and user permissions are checked before any API action is executed. Each organization contributing data to Genesys will have one or more registered user accounts on Genesys.
To modify any data in Genesys, you will need appropriate permissions. Permission to access and manage data for the organization is granted by helpdesk@genesys-pgr.org upon request. Please contact helpdesk@genesys-pgr.org with the list of FAO WIEWS codes of institutes you wish to manage.
To access resources with the APIs described in this manual, you will first need to create a user account. The simplest way is to use your Google+ account, or alternatively to create an account manually.

Access to the APIs is managed by the OAuth 2.0 protocol and implemented using spring-security OAuth modules. To obtain OAuth access and refresh tokens, you will first need a valid Client ID and Client Secret. These are generated by helpdesk@genesys-pgr.org for each individual consumer application. The ID and Secret listed below are valid for the Sandbox environment and allow out-of-band authentication when using curl
in the examples in this manual.
Client ID |
|
Client Secret |
|
1.1. Obtaining the access token
Most OAuth libraries, including the genesys-client-api Java library, will automatically obtain the access token following the OAuth protocol. This section describes how to manually obtain the tokens.
1.1.1. Authorization grant
Log in to Genesys with your account or Google+.
Obtain a verifier code by granting access to the "Genesys API reference" client. This is initiated by opening the authorization URL in a browser (please substitute CLIENTID
and SECRET
with valid data):
https://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. After your confirmation, the server will present an authorization code (which will look like: 7wXP1r
). 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'
1.1.2. Username and password
The password grant is available to trusted, secure clients (e.g. desktop 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'
1.1.3. Client credentials
System-to-system integration should not require user interaction. For that specific purpose, Genesys allows for an OAuth 2.0 client credentials grant.
With Genesys release 2.3, the client authentication grant is also supported. Kindly contact helpdesk@genesys-pgr.org for information on how to enable system-to-system integration and to grant your client the appropriate permissions on Genesys.
The client will be able to modify any data on Genesys on your behalf. |
For more details, read the section "Client Credential Grant" in A Guide To OAuth 2.0 Grants.
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'
This type of grant takes out the user authentication and authenticates the remote system with Genesys, immediately issuing an access token.
1.1.4. Successful authorization
The server will respond with access token details in JSON format:
{
"access_token": "28d96a4e-9a31-479b-abc8-17ee1e8c9906",
"token_type": "bearer",
"refresh_token": "2583fd78-bd88-4c2b-afc0-fb231b37d95f",
"expires_in": 43199,
"scope": "read write"
}
You can use the access token to sign future HTTP requests to the API by adding a HTTP request header:
Authorization: Bearer OAUTH-ACCESS-TOKEN
as a curl
parameter:
curl -H "Authorization: Bearer OAUTH-TOKEN" https://sandbox.genesys-pgr.org
or by including it in the request URL as a query string parameter:
$ curl 'https://sandbox.genesys-pgr.org/api/v0/me?access_token=OAUTH-ACCESS-TOKEN'
1.2. Using the refresh token
OAuth access tokens have a fairly short lifetime. When an access token expires, the refresh token can be used to obtain a new access token. The refresh token is returned as part of the JSON response when a verification code is used to obtain the access token:
{
"access_token": "28d96a4e-9a31-479b-abc8-17ee1e8c9906",
"token_type": "bearer",
"refresh_token": "2583fd78-bd88-4c2b-afc0-fb231b37d95f",
"expires_in": 43199,
"scope": "read write"
}
The refresh token must be securely persisted and can be used to request a new access token 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'
2. Client errors
The API returns descriptive information in the response body about why the request failed to execute.
2.1. 401 Unauthorized
401 Unauthorized indicates that the request did not include valid authentication data. Check your OAuth access token.
HTTP/1.1 401 Unauthorized
Content-Type: application/json;charset=UTF-8
...
WWW-Authenticate: Bearer realm="genesys2", error="unauthorized", error_description="An Authentication object was not found in the SecurityContext"
{"error":"unauthorized","error_description":"An Authentication object was not found in the SecurityContext"}
3. Managing passport data
Passport data is based on the FAO/Bioversity Multi-crop Passport Descriptors (MCPD V.2) format.
Accession records are upserted, meaning that:
-
when the matching accession record exists, it will be updated.
-
when it does not exist, a new record will be created.
Accession data in the database will be updated with whatever data is provided in the request JSON.
3.1. Accession identity
Prior to full adoption of Permanent Unique Identifiers for germplasm, accessions could be identified by the holding institute code (INSTCODE) and the accession number (ACCENUMB). However, genebanks maintaining two or more collections of crops sometimes use identical accession numbers in different collections.
For this reason, Genesys uses the INSTCODE, ACCENUMB and GENUS triplet to uniquely identify an accession. For accessions with a digital object identifier ( DOI) assigned in the ITPGRFA Secretariat Global Information System ( GLIS), it will use the DOI to uniquely identify the record.
1
2
3
4
5
6
7
{
"instCode": "NGA039", (1)
"doi": "10.1054/12A1~", (2)
"acceNumb": "TMp-123", (3)
"genus": "Musa", (4)
...
}
1 | Holding institute code (INSTCODE) |
2 | DOI of the accession as registered in GLIS |
3 | Accession number (ACCENUMB) |
4 | Genus (GENUS) |
3.2. JSON data model
The JSON data model of accession passport data closely follows MCPD definitions.
By default, institutes in Genesys are configured to "Use unique accession numbers within the institute". The accession JSON object must provide two identifying elements: instCode
and acceNumb
.
In cases where accession numbers are not unique within the institute, genus
is used to identify the unique accession within the institute. In such a case the Accession JSON object must always provide three identifying elements: instCode
, acceNumb
and genus
. All other fields are optional.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
"instCode": "XYZ111",
"doi": "10.1231/14S41Q",
"acceNumb": "M12345",
"cropName": "banana",
"genus": "Musa",
"species": "acuminata",
"spauthor": "Colla",
"subtaxa": "var. sumatrana",
"subtauthor": "(Becc.) Nasution",
"orgCty": "NGA",
"acqDate": "20010301",
"mlsStat": true,
"inTrust": false,
"available": true,
"historic": false,
"storage": [10, 20],
"sampStat": 200,
"duplSite": "BEL084",
"bredCode": "NGA039",
"ancest": "PED/IG*REE",
"remarks": [ "remark1", "remark2" ],
"acceUrl": "https://my-genebank.org/accession/1",
"geo": {
... (1)
},
"coll": {
... (2)
}
}
1 | JSON object with geographic data |
2 | JSON object with collecting data |
3.3. Geographic data JSON model
The geo
field in accession JSON captures geographic data.
1
2
3
4
5
6
7
8
{
"latitude": 13.12312,
"longitude": 42.2321,
"elevation": 123.2,
"coordUncert": 2000.0,
"coordDatum": "WGS84",
"georefMeth": "GPS"
}
Field name | Description |
---|---|
DECLATITUDE |
Latitude expressed in decimal degrees. Positive values are north of the Equator; negative values are south of the Equator (e.g. |
DECLONGITUDE |
Longitude expressed in decimal degrees. Positive values are east of the Greenwich Meridian; negative values are west of the Greenwich Meridian (e.g. |
ELEVATION |
Elevation of collecting site expressed in meters above sea level. Negative values are not allowed. |
COORDUNCERT |
Uncertainty associated with the coordinates in meters. Leave the value empty if the uncertainty is unknown. |
COORDDATUM |
The geodetic datum or spatial reference system upon which the coordinates given in decimal latitude and longitude are based (e.g. |
GEOREFMETH |
The georeferencing method used ( |
3.4. Collecting data JSON model
The coll
field in accession JSON captures collecting data.
1
2
3
4
5
6
7
8
9
10
{
"collDate": "1990----",
"collSite": "7km south of Curitiba in the state of Parana",
"collNumb": "C90-23",
"collSrc": 12,
"collCode": "PER001",
"collName": null,
"collInstAddress": null,
"collMissId": "C90"
}
Field name | Description |
---|---|
COLLDATE |
Collecting date of the sample, in the format |
COLLSITE |
Location information below the country level that describes where the accession was collected, preferably in English. This might include the distance in kilometers and direction from the nearest town, village or map grid reference point (e.g. |
COLLNUMB |
Original identifier assigned by the collector(s) of the sample, normally composed of the name or initials of the collector(s) followed by a number (e.g. |
COLLSRC |
Collecting/acquisition source. |
COLLCODE |
FAO WIEWS code of the institute that collected the sample. |
COLLNAME |
Name of the institute that collected the sample. This descriptor should only be used if COLLCODE cannot be filled because the FAO WIEWS code for this institute is not available. |
COLLINSTADDRESS |
Address of the institute that collected the sample. This descriptor should only be used if COLLCODE cannot be filled because the FAO WIEWS code for this institute is not available. |
COLLMISSID |
Identifier of the collecting mission as used by the collecting institute (e.g. |
3.5. Clearing existing values
To reset or clear an existing value in the accession passport data, it should be provided as null
. Not providing a field means the field in the database should not be modified.
null
value
1
2
3
4
5
6
{
"instCode": "NGA039",
"acceNumb": "TMp-123",
"genus": "Musa",
"orgCty": null
}
3.6. Insert or update accessions
REST endpoint URL /api/v0/acn/{instCode}/upsert
allows for inserting new accessions or updating existing records in Genesys. It accepts a JSON array of Accession JSON objects. The array provides for sending batches of 50 or 100 accessions in one call, reducing the HTTP overhead and improving performance.
Only the instCode and acceNumb are required (and in some cases the genus ). The server will return an error when the instCode of JSONs does not match the instCode in the URL! |
3.7. Deleting accessions
With the introduction of permanent identifiers for accession records in Genesys we have also introduced the accession archive. The archive holds passport data for accession records that have been deleted from the active database.
REST endpoint URL /api/v0/acn/{instCode}/delete
accepts an array of instCode
, acceNumb
, genus
triplets and deletes the corresponding accession records from Genesys. The DELETE permission is required for this operation.
The delete operation will fail if C&E data exists for any accessions listed. |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
POST /api/v0/acn/SYR002/delete
[{
"instCode": "SYR002",
"acceNumb": "12345",
"genus": "Vicia"
}, {
"instCode": "SYR002",
"acceNumb": "12345",
"genus": "Vicia"
}, {
"instCode": "SYR002",
"acceNumb": "IG 1",
"genus": "Vicia"
}]
4. Managing accession images
Institutes can upload accession images to the Genesys repository. Genesys will store and maintain images and metadata provided by institutes and display the images with accession passport data.
Genesys supports image galleries only for institutes that use unique ACCENUMB within their institute. |
Managing accession images in Genesys is done through methods available in the /api/v0/img/{instCode}/
namespace.
4.1. Listing existing galleries
To list existing accession image galleries for the INSTCODE, you must have the WRITE
or CREATE
permission on the institute record. Issue a GET
request to the /api/v0/img/{instCode}/_galleries
endpoint:
$ curl 'https://sandbox.genesys-pgr.org/api/v0/img/XXX001/_galleries?page=1' -i -X GET \
-H 'Content-Type: application/json;charset=UTF-8'
4.1.1. Path parameters
Parameter | Description |
---|---|
|
Institute WIEWS code (e.g. NGA039) |
4.1.3. Server response
The object returned by Genesys contains pagination information and basic image gallery data in the content
element.
content
element returned for an INSTCODE request
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"content": [{
"uuid": "4422e87e-52fe-38ef-b04a-079e663dd3da",
"version": 0,
"instCode": "XXX001",
"instEmail": "institute@localhost",
"state": 0,
"createdDate": null,
"lastModifiedDate": null,
"lastReminderDate": null
}], (1)
"last": true,
"totalElements": 1, (2)
"totalPages": 1, (3)
"size": 10, (4)
"number": 0,
"sort": [{
"direction": "DESC",
"property": "createdDate",
"ignoreCase": false,
"nullHandling": "NATIVE",
"ascending": false
}],
"first": true,
"numberOfElements": 1 (5)
}
1 | Array containing request information |
2 | Number of elements in the Genesys database |
3 | Number of pages |
4 | Page size |
5 | Number of elements in the content array |
Path | Type | Description |
---|---|---|
|
|
Array containing request headers |
|
|
Request UUID |
|
|
WIEWS institute code |
|
|
Institute email address to which request was relayed |
|
|
Request state |
|
|
Date when request was created |
|
|
Date when request was last relayed to specified email address |
|
|
Number of records in the content array |
|
|
Total number of requests in Genesys belonging to this institute |
|
|
Page size |
|
|
Current page number |
|
|
Page count |
|
|
Arrray sorting details |
4.3. Adding images to accessions
To add images to an accession you must first upload the image to Genesys with a PUT
request, with the image bytes in the request body:
$ 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
The request Content-Type
header must be set to the image content type (e.g. image/png
or image/jpeg
).
4.3.1. Path parameters
Parameter | Description |
---|---|
|
Institute WIEWS code (e.g. NGA039) |
|
Existing ACCENUMB in the institute |
4.3.2. Request parameters
Parameter | Description |
---|---|
|
Filename of the image (e.g. IMG00121.jpg) |
4.3.3. Server response
As Genesys accepts the image data, it will create a blank image metadata record and return the detailed image data, including the image UUID which is required for subsequent updates of the image metadata or the image bytes.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
"id": 1,
"contentType": "image/jpeg",
"format": "image/jpeg",
"uuid": "16648001-72b5-4295-ad29-169a414ee8f1",
"identifier": "urn:uuid:16648001-72b5-4295-ad29-569a414ee8f1",
"originalFilename": "maize.jpg",
"extension": ".jpg",
"path": "/accessions/XXX001/acn/ACC001/",
"filename": "16648001-72b5-4295-ad29-569a414ee8f1.jpg",
"url": "/accessions/XXX001/acn/ACC001/16648001-72b5-4295-ad29-569a414ee8f1.jpg",
"sha1Sum": "160599e1ccd66e132a9b92bc845a9591fe948586",
"md5Sum": "c1887df421746e30a41b898956ea1f3e",
"width": 640,
"height": 427,
"orientation": "LANDSCAPE",
"title": null,
"subject": null,
"description": null,
"creator": null,
"created": null,
"rightsHolder": null,
"accessRights": null,
"license": null,
"extent": null,
"bibliographicCitation": null,
"createdDate": null,
"lastModifiedDate": null,
"originalUrl": null,
"dateRetrieved": null,
"dateSubmitted": null,
"modified": null,
}
You will observe that most metadata is null
, but the image bytes are now stored in the Genesys repository. Genesys also determines the image width
, height
and orientation
from the image.
Path | Type | Description |
---|---|---|
|
|
UUID of the image in the Genesys repository |
|
|
Unique identifier assigned to the image by Genesys |
|
|
The original filename that you have provided |
|
|
Image extension derived from original filename (e.g. .jpg) |
|
|
The content type of the image (autodetected when possible) |
|
|
Image format |
|
|
Image size in bytes |
|
|
Location (directory) of the image in the Genesys repository |
|
|
The generated filename |
|
|
The folder where bytes are stored |
|
|
Path to the bytes in storage |
|
|
The generated filename for image metadata |
|
|
SHA1 hash of the image bytes |
|
|
MD5 hash of the image bytes |
|
|
Image width in pixels (autodetected) |
|
|
Image height in pixels (autodetected) |
|
|
LANDSCAPE or PORTRAIT orientation of the image (autodetected) |
|
|
Thumbnails folder |
4.4. Updating image metadata
After a successful upload of an image to the Genesys repository, you are able to manage the image metadata.
1
2
3
4
5
6
7
8
9
10
{
"title": "Leaf of ACC001",
"subject": "ACC001",
"description": "Image of leaf of ACC001 taken ...",
"creator": "John Doe",
"rightsHolder": "International Institute of Accessions (IIA)",
"accessRights": "Access rights",
"license": "https://creativecommons.org/publicdomain/zero/1.0/",
"bibliographicCitation": "Genesys Museum in Bonn. Digital image. Accession Imagery. Genesys. Web. 9 August 2016."
}
Path | Type | Description |
---|---|---|
|
|
Title is a property that refers to the name or names by which a resource is formally known |
|
|
The Subject described or pictured in the resource, accession number |
|
|
Description of the content of a resource. The description is a potentially rich source of indexable terms and assist the users in their selection of an appropriate resource. |
|
|
An entity primarily responsible for making the resource |
|
|
A point or period of time when the resource was created by the Creator |
|
|
Person or an organization owning or managing rights over this resource |
|
|
Access rights provides information about restrictions to view, search or use a resource based on attributes of the resource itself or the category of user. |
|
|
Legal document giving official permission to do something with the resource. E.g. http://www.gnu.org/licenses/gpl.html |
|
|
Size (e.g. bytes, pages, inches, etc.) or duration (e.g. hours, minutes, days, etc.) of a resource |
|
|
Formal bibliographic citation for the resource |
An example curl
request is:
$ curl 'https://sandbox.genesys-pgr.org/api/v0/img/XXX001/acn/ACC001/3f14a447-ea04-4a11-b7f1-bee160834333/_metadata' -i -X PUT \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{"active":true,"id":-20844,"title":"Leaf of ACC001","subject":"ACC001","description":"Image of leaf of ACC001 taken ...","creator":"John Doe","created":"August 2016","rightsHolder":"International Institute of Accessions (IIA)","accessRights":"Access rights","license":"https://creativecommons.org/publicdomain/zero/1.0/","extent":"4000x2000 pixels, 10MB","bibliographicCitation":"Genesys Museum in Bonn. Digital image. Accession Imagery. Genesys. Web. 9 August 2016.","size":0,"width":0,"height":0,"_class":"RepositoryImage","_permissions":{"create":true,"read":true,"write":true,"delete":true,"manage":true,"isPublic":false}}'
4.4.1. Path parameters
Parameter | Description |
---|---|
|
Institute WIEWS code (e.g. NGA039) |
|
Existing ACCENUMB in the institute |
|
UUID of the image in the gallery of this accession |
4.4.2. Response fields
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{
"id": 1,
"uuid": "1e23549e-a882-40b4-abc8-0a4708ba7ff3",
"path": "/accessions/XXX001/acn/ACC001/",
"originalFilename": "maize.jpg",
"extension": ".jpg",
"title": "Leaf of ACC001",
"subject": "ACC001",
"description": "Image of leaf of ACC001 taken ...",
"creator": "John Doe",
"created": null,
"rightsHolder": "International Institute of Accessions (IIA)",
"accessRights": "Access rights",
"license": "https://creativecommons.org/publicdomain/zero/1.0/",
"contentType": "image/jpeg",
"extent": null,
"bibliographicCitation": "Genesys Museum in Bonn. Digital image. Accession Imagery. Genesys. Web. 9 August 2016.",
"createdDate": null,
"lastModifiedDate": null,
"originalUrl": null,
"dateRetrieved": null,
"sha1Sum": "160599e1ccd66e132a9b92bc845a9591fe948586",
"md5Sum": "c1887df421746e30a41b898956ea1f3e",
"width": 640,
"height": 427,
"orientation": "LANDSCAPE",
"identifier": "urn:uuid:1e23549e-a882-40b4-abc8-0a4708ba7ff3",
"dateSubmitted": null,
"modified": null,
"format": "image/jpeg",
"url": "/accessions/XXX001/acn/ACC001/1e23549e-a882-40b4-abc8-0a4708ba7ff3.jpg",
"filename": "1e23549e-a882-40b4-abc8-0a4708ba7ff3.jpg"
}
Path | Type | Description |
---|---|---|
|
|
The original filename that you have provided |
|
|
Location (directory) of the image in the Genesys repository |
|
|
The generated filename |
|
|
The folder where bytes are stored |
|
|
Image width in pixels (autodetected) |
|
|
Image height in pixels (autodetected) |
|
|
LANDSCAPE or PORTRAIT orientation of the image (autodetected) |
|
|
Image format |
|
|
Permanent unique identifier of the resource. Commonly a Uniform Resource Locator (URL). |
|
|
Title is a property that refers to the name or names by which a resource is formally known |
|
|
The Subject described or pictured in the resource, accession number |
|
|
Description of the content of a resource. The description is a potentially rich source of indexable terms and assist the users in their selection of an appropriate resource. |
|
|
An entity primarily responsible for making the resource |
|
|
A point or period of time when the resource was created by the Creator |
|
|
Person or an organization owning or managing rights over this resource |
|
|
Access rights provides information about restrictions to view, search or use a resource based on attributes of the resource itself or the category of user. |
|
|
Legal document giving official permission to do something with the resource. E.g. http://www.gnu.org/licenses/gpl.html |
|
|
Size (e.g. bytes, pages, inches, etc.) or duration (e.g. hours, minutes, days, etc.) of a resource |
|
|
Formal bibliographic citation for the resource |
|
|
Image size in bytes |
|
|
Image width in pixels |
|
|
Image height in pixels |
5. Managing requests
Institutes can allow users to request material through Genesys. Genesys will validate the user’s email address (by waiting for them to click the confirmation link sent to their address) and also check if the user is registered with ITPGRFA’s Easy-SMTA database.
Genesys maintains a database of requests received, confirmed and dispatched to genebanks holding the requested materials. This API allows genebanks to retrieve the request data from Genesys for automated integration into their existing information systems.
A client may request material from several different genebanks in one session. Genesys splits the request and dispatches sub-requests to email addresses registered with individual genebanks. |
Managing crop data in Genesys is done through methods available in the /api/v0/requests
namespace.
5.1. Listing requests
To list all requests for a given INSTCODE, you must have the ADMINISTRATOR
permission on the institute record. Issue a GET
request to the /api/v0/requests/{instCode}
endpoint:
$ curl 'https://sandbox.genesys-pgr.org/api/v0/requests/XXX001?page=0' -i -X GET
5.1.1. Path parameters
Parameter | Description |
---|---|
|
Institute WIEWS code (e.g. NGA039) |
5.1.3. Server response
The object returned by Genesys contains pagination information and basic request data in the content
element.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
"content": [{
"uuid": "4422e87e-52fe-38ef-b04a-079e663dd3da",
"version": 0,
"instCode": "XXX001",
"instEmail": "institute@localhost",
"state": 0,
"createdDate": null,
"lastModifiedDate": null,
"lastReminderDate": null
}], (1)
"last": true,
"totalElements": 1, (2)
"totalPages": 1, (3)
"size": 10, (4)
"number": 0,
"sort": [{
"direction": "DESC",
"property": "createdDate",
"ignoreCase": false,
"nullHandling": "NATIVE",
"ascending": false
}],
"first": true,
"numberOfElements": 1, (5)
}
1 | Array containing request information |
2 | Number of elements in the Genesys database |
3 | Number of pages |
4 | Page size |
5 | Number of elements in the content array |
Path | Type | Description |
---|---|---|
|
|
Array containing request headers |
|
|
Request UUID |
|
|
WIEWS institute code |
|
|
Institute email address to which request was relayed |
|
|
Request state |
|
|
Date when request was created |
|
|
Date when request was last relayed to specified email address |
|
|
Number of records in the content array |
|
|
Total number of requests in Genesys belonging to this institute |
|
|
Page size |
|
|
Current page number |
|
|
Page count |
|
|
Arrray sorting details |
5.2. Request details
To retrieve request details from Genesys:
$ curl 'https://sandbox.genesys-pgr.org/api/v0/requests/XXX001/r/5f54124a-bb8c-4feb-8282-12b6aedf570d' -i -X GET \
-H 'Content-Type: application/json;charset=UTF-8'
5.2.1. Path parameters
Parameter | Description |
---|---|
|
Institute WIEWS code (e.g. NGA039) |
|
UUID of the request |
5.2.2. Server response
1
2
3
4
5
6
7
8
9
10
{
"uuid": "7ecb3c6e-63d8-3869-b2c7-28571c9e2864",
"version": 0,
"instCode": "XXX001",
"instEmail": "institute@localhost",
"state": 0,
"createdDate": null,
"lastModifiedDate": null,
"lastReminderDate": null
}
Path | Type | Description |
---|---|---|
|
|
The request UUID |
|
|
Record version indicator |
|
|
WIEWS code of the institute handling the request |
|
|
Email address to which Genesys sends notifications |
|
|
The request STATE indicator |
|
|
Date of last email notification sent to institute |
6. Managing crop data
Genesys maintains a database of crops and crop groups (e.g. forages). In addition to the general description, each crop defines a list of taxonomic rules that determine which taxonomies are included (or excluded) in the group.
Crops and crop groups are referred to and identified by the crop’s short name. The short name placeholder in documentation below is marked by {shortName}
. The short name should have no spaces and it should contain US-ASCII characters only (a-Z, 0-9).
6.1. Crop taxonomic rules
The common crop name of an accession in Genesys is determined by its taxonomy. For example, the crop banana includes accessions of the genus Musa.
-
Each crop and crop group defines its own taxonomic rules.
-
The genus, species and sub-species data of an accession is matched against all taxonomic rules.
-
The accession is linked with all matching crops.
-
The accession may have more than one "crop".
-
Managing crop data in Genesys is done through methods available in the /api/v0/crops
namespace.
6.2. Listing all crops
A number of crops and crop groups are usually defined and used in Genesys. To list all crops, issue a GET
request to the /api/v0/crops/
endpoint:
$ curl 'https://sandbox.genesys-pgr.org/api/v1/crops' -i -X GET \
-H 'Content-Type: application/json;charset=UTF-8'
The result is a JSON array of all crops in Genesys.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
[{
"id": 27,
"version": 1,
"rdfUri": null,
"shortName": "apple",
"name": "Apple",
"description": null,
"i18n": "{\"name\":{\"fa\":\"سیب\"}}"
}, {
"id": 1,
"shortName": "banana",
"name": "Banana", ... (1)
}, {
"shortName": "barley",
"name": "Barley", ...
},
...]
1 | Some JSON elements removed for readability. |
6.3. Retrieving crop data
The crop details are retrievable with a GET
request to /api/v0/crops/{shortName}
.
Parameter | Description |
---|---|
|
Crop short name or code (e.g. maize) |
curl
request to fetch maize crop definition
$ curl 'https://sandbox.genesys-pgr.org/api/v1/crops/maize' -i -X GET \
-H 'Content-Type: application/json;charset=UTF-8'
The JSON representation of a single crop record includes the following fields.
Path | Type | Description |
---|---|---|
|
|
Autogenerated ID |
|
|
Record version |
|
|
Crop name in English |
|
|
Crop short name or code (e.g. maize) |
|
|
Crop description in English |
|
|
URI of RDF term describing the crop |
|
|
i18n map |
|
|
Alternative spellings of the crop name |
6.3.1. Taxonomic rules
The /api/v0/crops/{shortName}/rules
endpoint exposes access to a crop’s taxonomic rules. We mentioned earlier that accessions with the genus Musa belong to bananas; similarly, accessions of the Zea genus belong to maize:
$ curl 'https://sandbox.genesys-pgr.org/api/v1/crops/maize/rules' -i -X GET \
-H 'Content-Type: application/json;charset=UTF-8'
1
2
3
4
5
6
7
[{
"id": 24,
"included": true, (1)
"genus": "Zea", (2)
"species": null, (3)
"subtaxa": null, (4)
}]
1 | The combination of genus, species and subtaxa can be either included or explicitly excluded from the crop. |
2 | An accession is included in maize when accession’s genus value is Zea . |
3 | Species field is null meaning that accession species is ignored by this rule. |
4 | Subtaxa field is null meaning that accession subtaxa value is ignored by this rule. |
6.4. Registering a new crop
To create a new crop, a JSON with the following data must be submitted.
1
2
3
4
5
{
"shortName": "maize",
"name": "Maize",
"description": "Crop description in EN"
}
Path | Type | Description |
---|---|---|
|
|
Crop short name or code (e.g. maize) |
|
|
Crop name in English |
|
|
Crop description in English |
The response is a single crop record as stored on the server.
$ curl 'https://sandbox.genesys-pgr.org/api/v1/crops/save' -i -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{"shortName":"rice","name":"Rice","description":"Crop description in EN"}'
6.5. Localization of crop title and description
The i18n
field of the JSON crop object is a string encoded JSON object of a two level JSON formatted dictionary string with first level keys name
(for the name field) and description
(for the description field) and second level keys corresponding to ISO_639_2 encoded vernacular language tags.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
{
"name": {
"en": "Musa",
"es": "Musa",
"ru": "Муса",
"zh": "穆萨"
},
"description": {
"en": "Bananas and plantains",
"es": "Los bananos y plátanos",
"ru": "Бананы и бананы",
"zh": "香蕉和大蕉"
}
}
6.6. Updating taxonomic rules
Taxonomic rules can be replaced using one call by providing the new list of rules as the body of the HTTP PUT
call to /api/v0/crops/{shortName}/rules
. To specify that all Triticum and Aegilops species should be included in wheat, you would send the following array of rules to /api/v0/crops/wheat/rules
1
2
3
4
5
6
7
[{
"included": true,
"genus": "Triticum"
}, {
"included": true,
"genus": "Aegilops"
}]
$ curl 'https://sandbox.genesys-pgr.org/api/v0/crops/maize/rules' -i -X PUT \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '[{"id":-20394,"included":true,"genus":"Zea","species":"mays","subtaxa":"var. foobaria","_class":"CropRule"}]'
Path | Type | Description |
---|---|---|
|
|
Specifies whether the rule is an including or an excluding rule |
|
|
Accession is included in the crop when its genus matches specified value. |
|
|
Accession is included in the crop when its species matches specified value. |
|
|
Accession is included in the crop when its subtaxa matches specified value. |
6.7. Deleting a crop
A crop record can be deleted by issuing an HTTP DELETE
request to /api/v0/crops/{shortName}
. This will remove the crop and crop rules from the system.
$ curl 'https://sandbox.genesys-pgr.org/api/v1/crops/rice' -i -X DELETE \
-H 'Content-Type: application/json;charset=UTF-8'