-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started with SWODLR‐API
Josh Garde edited this page Oct 11, 2023
·
1 revision
The primary entrypoint into the SWODLR system is the swodlr-api service. This service is a GraphQL-first API allowing for user-facing interactions with the larger system.
To authenticate with the service, an EDL token may be sent as part of every request as part of an HTTP Authorization header bearer token. For example:
Authorization: Bearer [TOKEN HERE]
The primary endpoint for the API is /graphql
. Only a POST
requests are allowed to this endpoint containing the query to execute and the variables that are associated with the query. This is typically done as a JSON object. The additional details about this request can be found here: https://graphql.org/learn/serving-over-http/#post-request
Some example API queries are provided below:
{
currentUser {
id
firstName
lastName
email
}
}
{
currentUser {
products {
id
cycle
pass
scene
outputSamplingGridType
rasterResolution
outputGranuleExtentFlag
mgrsBandAdjust
utmZoneAdjust
granules {
id
timestamp
uri
}
status {
id
state
reason
timestamp
}
}
}
}
query {
currentUser {
rasterDefinitions {
name
id
outputSamplingGridType
rasterResolution
outputGranuleExtentFlag
mgrsBandAdjust
utmZoneAdjust
}
}
}
mutation (
$name: String!,
$outputGranuleExtentFlag: Boolean!
$outputSamplingGridType: GridType!,
$rasterResolution: Int!
$utmZoneAdjust: Int,
$mgrsBandAdjust: Int
){
createRasterDefinition(
name: $name,
outputGranuleExtentFlag: $outputGranuleExtentFlag,
outputSamplingGridType: $outputSamplingGridType,
rasterResolution: $rasterResolution,
utmZoneAdjust: $utmZoneAdjust,
mgrsBandAdjust: $mgrsBandAdjust
) {
id
}
}
Variables:
{
"name": "Test_2",
"outputGranuleExtentFlag": false,
"outputSamplingGridType": "UTM",
"rasterResolution": 100,
"utmZoneAdjust": 0,
"mgrsBandAdjust":0
}
mutation ($id: ID!) {
deleteRasterDefinition(id: $id)
}
Variables:
{
"id": "40b491cc-d143-47b6-bc94-9013356b6397"
}
mutation Test (
$cycle: Int!
$pass: Int!
$scene: Int!
$outputGranuleExtentFlag: Boolean!
$outputSamplingGridType: GridType!
$rasterResolution: Int!
$utmZoneAdjust: Int
$mgrsBandAdjust: Int
){
generateL2RasterProduct(
cycle: $cycle,
pass: $pass,
scene: $scene,
outputGranuleExtentFlag: $outputGranuleExtentFlag
outputSamplingGridType: $outputSamplingGridType
rasterResolution: $rasterResolution
utmZoneAdjust: $utmZoneAdjust
mgrsBandAdjust: $mgrsBandAdjust
) {
id
status {id, state}
}
}
Variables
{
"cycle": 1,
"pass": 401,
"scene": 125,
"outputGranuleExtentFlag": false,
"outputSamplingGridType": "UTM",
"rasterResolution": 10000,
"utmZoneAdjust": 0,
"mgrsBandAdjust": 0
}
{
statusByProduct(product: "07f9795e-7d11-481a-9ebd-ac51fc66d3f3") {
id
state
timestamp
reason
}
}