Difference between revisions of "Documents/API"

From GeoDash
Jump to: navigation, search
(Supported API in GeoDASH)
(/api/layerupload - HTTP POST)
Line 331: Line 331:
 
|}
 
|}
 
<br>
 
<br>
 +
 +
 +
 +
===/api/import/===
 +
 +
<pre>
 +
 +
Status: 200 OK
 +
Content-Type: application/json
 +
 +
        {
 +
          "imports": [{
 +
            "id": 0,
 +
            "state": "COMPLETE",
 +
            "href": "http://localhost:8080/geoserver/rest/imports/0"
 +
 +
          }, {
 +
            "id": 1,
 +
            "state": "PENDING",
 +
            "href": "http://localhost:8080/geoserver/rest/imports/1"
 +
          }]
 +
        }
 +
 +
</pre>

Revision as of 13:12, 18 November 2016

Supported API in GeoDASH

  • /api/base query on the ResourceBase table and returns combined results of Maps, Layers Documents and Services
  • /api/layers query the Layer table
  • /api/maps query the Map table
  • /api/documents query the Document table
  • /api/groups query the GroupProfile table (which contains the Groups)
  • /api/profiles query the Profile table (which is the geonode authentication table)
  • /api/categories query the Category table
  • /api/keywords query the Tag table
  • /api/featured query the ResouceBase table by limiting the items to the ones flagged as “featured”
  • /imports- An import refers to the top level object and is a “session” like entity the state of the entire import.

Refference: http://docs.geonode.org/en/master/reference/api.html



Tested API in GeoDASH

  1. /api/layers/
  2. /api/maps/
  3. /api/documents/
  4. /api/categories/
  5. /api/groups/
  6. /api/keywords/
  7. /api/user-organization-list/
  8. /api/layerupload - HTTP POST


Note that no. 7 and no. 8 are implemented on SDSL server (116.212.105.8). Other calls (no. 1 to no. 6) are available on live server (geodash.gov.bd).



Response for the Tested API

/api/layers/

{
  "meta": {
    "limit": 0,
    "offset": 0,
    "total_count": 14
  },
  "objects": [
    {
      "abstract": "No abstract provided",
      "category__gn_description": "administrative",
      "csw_type": "dataset",
      "csw_wkt_geometry": "POLYGON((88.5913167150001 22.344238955,88.5913167150001 25.135587505,92.3926635270001 25.135587505,92.3926635270001 22.344238955,88.5913167150001 22.344238955))",
      "date": "2016-06-28T00:40:43.528705",
      "detail_url": "/layers/geonode:checking_status_3_5",
      "id": 117,
      "owner__username": "wasauser",
      "popular_count": 0,
      "rating": 0,
      "share_count": 0,
      "srid": "EPSG:4326",
      "supplemental_information": "No information provided",
      "thumbnail_url": "http://localhost:8000/uploaded/thumbs/layer-db0531d6-3cf2-11e6-b88b-b4b52f88e33f-thumb.png",
      "title": "checking status 3",
      "uuid": "db0531d6-3cf2-11e6-b88b-b4b52f88e33f"
    }
]
}


/api/maps/

{
  "meta": {
    "limit": 0,
    "offset": 0,
    "total_count": 2
  },
  "objects": [
    {
      "abstract": "",
      "category__gn_description": "Geoscientific Information",
      "csw_type": "dataset",
      "csw_wkt_geometry": "POLYGON((-180 -90,-180 90,180 90,180 -90,-180 -90))",
      "date": "2016-06-23T03:40:52.771121",
      "detail_url": "/maps/112",
      "id": 112,
      "owner__username": "wasauser",
      "popular_count": 7,
      "rating": 0,
      "share_count": 0,
      "srid": "EPSG:4326",
      "supplemental_information": "No information provided",
      "thumbnail_url": "http://localhost:8080/geoserver/wms/reflect?layers=geonode:ttttttt&width=200&height=150&bbox=87.7453861455,23.3928879107,93.2385940713,24.1018947340&format=image/png8",
      "title": "yyyyy",
      "uuid": "3541d1e6-391e-11e6-8c7d-2cd05a9b2d04"
    }
]
}


/api/documents/


{
  "meta": {
    "limit": 0,
    "offset": 0,
    "total_count": 1
  },
  "objects": [
    {
      "abstract": "No abstract provided",
      "category__gn_description": "administrative",
      "csw_type": "document",
      "csw_wkt_geometry": "POLYGON((-180 -90,-180 90,180 90,180 -90,-180 -90))",
      "date": "2016-06-05T01:31:30.601308",
      "detail_url": "/documents/11",
      "id": 11,
      "owner__username": "wasauser",
      "popular_count": 2,
      "rating": 0,
      "share_count": 0,
      "srid": "EPSG:4326",
      "supplemental_information": "No information provided",
      "thumbnail_url": "http://localhost:8000/uploaded/thumbs/doc-11-thumb.png",
      "title": "test",
      "uuid": "23b92a5e-2ae7-11e6-bfcd-b4b52f88e33f"
    }
  ]
}


/api/categories/

{
  "meta": {
    "limit": 1000,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 42
  },
  "objects": [
    {
      "count": 78,
      "description": "administrative",
      "description_en": "administrative",
      "gn_description": "administrative",
      "gn_description_en": "administrative",
      "id": 39,
      "identifier": "administrative",
      "is_choice": true,
      "resource_uri": "/api/categories/39/"
    }
],
  "requested_time": 1467090964.651355
}


/api/groups/


{
  "meta": {
    "limit": 1000,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 3
  },
  "objects": [
       {
      "access": "public",
      "description": "Dhaka WASA (Water Supply & Sewerage Authority) was established in the year 1963 as an independent organization, under the East Pakistan ordinance XIX. In 1989, the drainage system of Dhaka city also handed over to DWASA from DPHE. Again in the year 1990, Water, Drainage & Sanitation service of Narayangonj city handed over to DWASA.",
      "detail_url": "/groups/group/wasa/",
      "email": "",
      "id": 2,
      "last_modified": "2016-06-05T07:26:04.726646",
      "logo": "/uploaded/people_group/download.jpg",
      "manager_count": 1,
      "member_count": 5,
      "resource_uri": "/api/groups/2/",
      "slug": "wasa",
      "title": "wasa"
    }
]
}


api/keywords/


{
  "meta": {
    "limit": 1000,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 59
  },
  "objects": [
    {
      "count": 2,
      "id": 8,
      "name": "2",
      "resource_uri": "/api/keywords/8/",
      "slug": "2"
    }
  ],
  "requested_time": 1467091153.328208
}



/api/user-organization-list/


{
  "meta": {
    "limit": 1000,
    "next": null,
    "offset": 0,
    "previous": null,
    "total_count": 2
  },
  "objects": [
    {
      "count": null,
      "group": {
        "access": "public",
        "description": "Dhaka WASA (Water Supply & Sewerage Authority) was established in the year 1963 as an independent organization, under the East Pakistan ordinance XIX. In 1989, the drainage system of Dhaka city also handed over to DWASA from DPHE. Again in the year 1990, Water, Drainage & Sanitation service of Narayangonj city handed over to DWASA.",
        "detail_url": "/groups/group/wasa/",
        "email": "",
        "id": 2,
        "last_modified": "2016-06-05T07:26:04.726646",
        "logo": "/uploaded/people_group/download.jpg",
        "manager_count": 1,
        "member_count": 5,
        "resource_uri": "/api/groups/2/",
        "slug": "wasa",
        "title": "wasa"
      },
      "id": 6,
      "joined": "2016-05-29T05:20:54.034655",
      "resource_uri": "/api/user-organization-list/6/",
      "role": "member",
      "user": "/api/profiles/7/"
    }
]
}


/api/layerupload - HTTP POST


Body Data Type Mandatory Description
username String Yes Username for the user, the layer will belongs to
password String Yes Password for the equested user
layer_title String Yes Title for the layer
organization Integer Yes Id of organization for which the layer should be uploaded
charset String Yes UTF-8
permissions String Yes A string of permissions in a dictionary format. The uploaded layer will act according to this permissions.
category String Yes Category defines the category of the uploaded layer.
base_file File Yes A ‘.zip’ file which contains five files for uploading layer(.cst, .dbf, .prj, .shp, .shx)
Sample Response {
"url": "/layers/geonode:layer_title",
"success": true
}



/api/import/


Status: 200 OK
Content-Type: application/json

        {
           "imports": [{
             "id": 0,
             "state": "COMPLETE",
             "href": "http://localhost:8080/geoserver/rest/imports/0"

           }, {
             "id": 1,
             "state": "PENDING",
             "href": "http://localhost:8080/geoserver/rest/imports/1"
           }]
        }