Skip to content

Using API to Upload Spots

Jason Ash edited this page Dec 8, 2017 · 10 revisions

Steps to use API to upload Spots

Notes:

modified_timestamp is unix_time + milliseconds for a total of 13 digits.

id is unix_time + 4 random integers for a total of 14 digits.

All API calls use HTTP Basic Auth for authentication

First, create a project...

POST https://strabospot.org/db/project

{
   "modified_timestamp":1512678555360,
   "description":{
      "project_name":"My test project"
   },
   "date":"2017-12-07T20:28:54.036Z",
   "id":15126785340366
}

Next, create a dataset...

POST https://strabospot.org/db/dataset

{
   "name":"My Test Dataset",
   "date":"2017-12-07T20:28:54.116Z",
   "id":15126785341167,
   "modified_timestamp":1512678534116
}

Next, add dataset to project...

POST https://strabospot.org/db/projectDatasets/15126785340366

{
	"id":15126785341167
}

Next, use datasetspots controller to add spots to dataset...

POST https://strabospot.org/db/datasetspots/15126785341167

{
   "type":"FeatureCollection",
   "features":[
      {
         "type":"Feature",
         "geometry":{
            "type":"Point",
            "coordinates":[
               -97.67941037592203,
               38.5767240414678
            ]
         },
         "properties":{
            "date":"2017-12-08T02:37:04.000Z",
            "time":"2017-12-08T02:37:04.000Z",
            "id":15127006246996,
            "name":"15127006246996",
            "modified_timestamp":1512700893733,
            "orientation_data":[
               {
                  "type":"planar_orientation",
                  "id":15127006596617,
                  "label":"Plane label",
                  "strike":12,
                  "dip_direction":23,
                  "dip":34,
                  "quality":"4",
                  "feature_type":"fault",
                  "fault_or_sz_type":"sinistral_normal",
                  "movement":"ne_side_up",
                  "movement_justification":[
                     "offset_bedding"
                  ],
                  "directional_indicators":[
                     "riedel_shear"
                  ],
                  "movement_amount_m":1,
                  "movement_amount_qualifier":"maximum_amount",
                  "thickness":0.5,
                  "length":12,
                  "notes":"Notes here"
               },
               {
                  "type":"linear_orientation",
                  "id":15127008204398,
                  "label":"Line label",
                  "trend":12,
                  "plunge":23,
                  "rake":34,
                  "rake_calculated":"yes",
                  "quality":"4",
                  "feature_type":"pencil_cleav",
                  "defined_by":"Defined by here",
                  "notes":"Line notes here"
               }
            ]
         }
      }
   ]
}