IDigBio API v1 Examples: Difference between revisions

Jump to navigation Jump to search
(add idigbio:links)
Line 1,233: Line 1,233:
Deeper integration of iDigBio mapping requires understanding of geohashes and would be a more significant undertaking. If your project wishes advanced integration, please contact iDigBio. https://www.idigbio.org/contact
Deeper integration of iDigBio mapping requires understanding of geohashes and would be a more significant undertaking. If your project wishes advanced integration, please contact iDigBio. https://www.idigbio.org/contact


=== idigbio:links and the 20 Item list ===
=== idigbio:links and the 20 Item List ===


Compare the idigbio:links section of two publisher JSON responses:
Compare the idigbio:links section of the following two Publisher records:


http://api.idigbio.org/v1/publishers/076c0ff6-65e9-48a5-8e4b-2447936f9a1c
http://api.idigbio.org/v1/publishers/076c0ff6-65e9-48a5-8e4b-2447936f9a1c
http://api.idigbio.org/v1/publishers/4e1beef9-d7c0-4ac0-87df-065bc5a55361
http://api.idigbio.org/v1/publishers/4e1beef9-d7c0-4ac0-87df-065bc5a55361
The first Publisher record returns a JSON document containing "idigbio:links" and a List of recordsets (or to be more precise, a List of API urls that can be used to access individual Recordset records by iDigBio UUID). Since the number of recordsets is less than 20, they are included in the Publisher record output.
<pre>
$ curl -s http://api.idigbio.org/v1/publishers/076c0ff6-65e9-48a5-8e4b-2447936f9a1c | json_pp
{
  "idigbio:uuid" : "076c0ff6-65e9-48a5-8e4b-2447936f9a1c",
  "idigbio:etag" : "31b115d5a307027f757554441c93d8e5b8ac8fab",
  "idigbio:links" : {
      "recordset" : [
        "http://api.idigbio.org/v1/recordsets/197f7bb8-213d-4fae-b536-652dd91e56dc",
        "http://api.idigbio.org/v1/recordsets/31c140bc-e6f1-4acc-beaf-b825cf288ad9",
        "http://api.idigbio.org/v1/recordsets/5aac25d2-bcfb-4084-a700-584311ea539d",
        "http://api.idigbio.org/v1/recordsets/5e893602-84ca-4c8c-bac1-99111c777582",
        "http://api.idigbio.org/v1/recordsets/6539877e-82dc-485c-ad3d-038f383d5431",
        "http://api.idigbio.org/v1/recordsets/69037495-438d-4dba-bf0f-4878073766f1",
        "http://api.idigbio.org/v1/recordsets/7fcdca8e-7469-480c-8516-cce4e24c37c9",
        "http://api.idigbio.org/v1/recordsets/82541f90-fe8e-4d66-84d8-4fe515dc5533",
        "http://api.idigbio.org/v1/recordsets/89eb1ad0-ae60-4e8a-bf34-a53d0423bc80",
        "http://api.idigbio.org/v1/recordsets/92dd8c8e-c048-4f0a-9b5d-2ee627d2f553",
        "http://api.idigbio.org/v1/recordsets/9ace4c05-d930-45c7-8d2d-0cadff1ea32b",
        "http://api.idigbio.org/v1/recordsets/9bd4ff72-1cb2-431f-bf7b-b5d47e08cc02",
        "http://api.idigbio.org/v1/recordsets/a3b77120-3770-46dd-ba47-6941eff848b3",
        "http://api.idigbio.org/v1/recordsets/ab4b6a2b-a90a-44ce-95a1-2c44c911fcc6",
        "http://api.idigbio.org/v1/recordsets/cb65cf5e-07b8-4d53-a91a-7dce9b8ccf80",
        "http://api.idigbio.org/v1/recordsets/d315c4a3-0bee-49d1-8d03-726358937cde",
        "http://api.idigbio.org/v1/recordsets/d767f759-af64-4464-8614-c77ca44cad8d",
        "http://api.idigbio.org/v1/recordsets/f83517ea-7b9f-443d-9371-d11a05ebc0a7",
        "http://api.idigbio.org/v1/recordsets/ff111763-e72d-4f24-8914-b5b2dd94908c"
      ]
  },
...
</pre>
The second link returns a JSON document containing "idigbio:links" and a single recordset link rather than a List.  To get to the List of recordsets for this Publisher record, this intermediate link needs to be followed.


<pre>
<pre>
# Example to be provided.
$ curl -s http://api.idigbio.org/v1/publishers/4e1beef9-d7c0-4ac0-87df-065bc5a55361 | json_pp
{
  "idigbio:uuid" : "4e1beef9-d7c0-4ac0-87df-065bc5a55361",
  "idigbio:etag" : "01c8eabbf9e8fe7f5af86349b04cad55b3ddee8e",
  "idigbio:links" : {
      "recordset" : [
        "http://api.idigbio.org/v1/publishers/4e1beef9-d7c0-4ac0-87df-065bc5a55361/recordsets"
      ]
  },
...
</pre>
</pre>


As suspected, the list of Recordsets includes more than 20 items (in this case, 51 recordset items) which is why they were not displayed with the Publisher record.


<pre>
$ curl -s http://api.idigbio.org/v1/publishers/4e1beef9-d7c0-4ac0-87df-065bc5a55361/recordsets | json_pp | grep recordset | wc -l
51
$ curl -s http://api.idigbio.org/v1/publishers/4e1beef9-d7c0-4ac0-87df-065bc5a55361/recordsets | json_pp
{
  "idigbio:errors" : [],
  "idigbio:links" : {},
  "idigbio:items" : [
      {
        "idigbio:links" : {
            "recordset" : "http://api.idigbio.org/v1/recordsets/0072bf11-a354-4998-8730-c0cb4cfc9517"
        },
        "idigbio:uuid" : "0072bf11-a354-4998-8730-c0cb4cfc9517"
      },
      {
        "idigbio:links" : {
            "recordset" : "http://api.idigbio.org/v1/recordsets/00d9fcc1-c8e2-4ef6-be64-9994ca6a32c3"
        },
        "idigbio:uuid" : "00d9fcc1-c8e2-4ef6-be64-9994ca6a32c3"
      },
      {
        "idigbio:links" : {
            "recordset" : "http://api.idigbio.org/v1/recordsets/0dd7c8dd-412c-4a13-a1d3-47e1e1af5455"
        },
        "idigbio:uuid" : "0dd7c8dd-412c-4a13-a1d3-47e1e1af5455"
      },
      {
        "idigbio:links" : {
            "recordset" : "http://api.idigbio.org/v1/recordsets/181352ea-3598-4f32-b919-c8f6097f4c65"
        },
        "idigbio:uuid" : "181352ea-3598-4f32-b919-c8f6097f4c65"
      },
      {
        "idigbio:links" : {
            "recordset" : "http://api.idigbio.org/v1/recordsets/196bb137-2f82-40d5-b294-e730af29749f"
        },
        "idigbio:uuid" : "196bb137-2f82-40d5-b294-e730af29749f"
      },
...
</pre>


=== API Performance ===
=== API Performance ===
1,554

edits

Navigation menu