Skip to content

Ordering


The Ordering portion of the MGP_SDK enables customers to acquire Maxar content for offline use. Customers can create orders via API request using the results of their Discovery request by submitting a set of delivery type and content-specific parameters to the Ordering API. Submission to the Ordering API asynchronously triggers the content production pipeline to deliver the requested data. The Order is delivered to the location set by the customer in their Order request. The Ordering service has built-in order tracking, notifications, and error management for every request. These validation mechanisms will prevent users from exceeding their allowed usage.


Getting Started

from MGP_SDK.interface import Interface

ordering = Interface().order_service

Package methods

Place a New Order

place_order()

Places an order for the given group of pipelines and pipeline name

Args:

  • namespace: (str) A group of pipelines (e.g. 'imagery')
  • name: (str) Name of the pipeline to order from (e.g. 'analysis-ready')
  • output_config: (dict) (optional) Delivery configuration. Amazon S3, Google Cloud Storage, Azure Blob storage are supported.
  • settings: (dict) Settings specific to this pipeline. (required if the requested pipeline requires user-provided input parameters and has a json_schema attribute)

Kwargs:

  • notifications: (list), (optional) Destination(s) where notifications should be sent. Multiple notifications of the same type can be created, each having its own notification level.
  • metadata: (dict)(optional) Supplemental information to attach to this order
  • validate: (bool) (optional, default = False) True if user requests to validate order before sending
settings = {"acquisitions": [{"id": "10403C0001FD6000"}],
            "bbox": [-106.8, 35.1, -106.4, 35.4],
            "ard_settings": {
                "bundle_adjust": True,
                "healthy_vegetation_mask": True,
                "water_mask": False}
            }

output_config = {
    "amazon_s3": {
        "bucket": "user-docs-demo",
        "prefix": "albuquerque"}
    }
notifications = [
    {
        "type": "email",
        "target": "username@myemail.com",
        "level": "INITIAL_FINAL"
    }
]
metadata = {"project_id": "albuquerque-cars"}

ordering.place_order('imagery', 'analysis-ready', settings, output_config, 
                     notifications=notifications, metadata=metadata, validate=True)

Estimate Order Usage

get_usage_estimate()

Get a usage estimate for the order

Args:

  • namespace: (str) A group of pipelines (e.g. 'imagery')
  • name: (str) Name of the pipeline to order from (e.g. 'analysis-ready')
  • output_config: (dict) (optional) Delivery configuration. Amazon S3, Google Cloud Storage, Azure Blob storage are supported.
  • settings: (dict) settings specific to this pipeline. (required if the requested pipeline requires user-provided input parameters and has a json_schema attribute)

Kwargs:

  • notifications: (list) (optional) Destination(s) where notifications should be sent. Multiple notifications of the same type can be created, each having its own notification level.
  • metadata: (dict) (optional) Supplemental information to attach to this order
settings = {'settings'}
output_config = {'output config'}
notifications = {'notifications'}
metadata = {'metadata'}
order_usage = ordering.get_usage_estimate('imagery', 'analysis-ready', settings, output_config, 
                                          notifications=notifications, metadata=metadata)
print(order_detials)

Cancel an Order

cancel_order()

Cancels an order is pipeline supports canceling

Args:

  • order_id: (str) The ID of the Order to cancel
ordering.cancel_order('99926034175760632')

Cancel Multiple Orders

cancel__multiple_orders()

Cancels orders based on a list containing order IDs

Args:

  • order_id: (list[str]) List containing the IDs of the Orders to cancel
order_list = ['99926034175760632', '99926034175760631', '99926034175760630']
ordering.cancel__multiple_order(order_list)

Get Order Details

get_order_details()

Gets the IDs of all Orders that match the search criteria and the user can access.

Args:

  • order_id: (str) The ID of the order
order_details = ordering.get_order_details('99926034175760632')
print(order_details)

Get User Orders

get_user_orders()

Returns a list of a users order by user ID. If no ID is provided, returns a list of the authenticated user's orders.

Args:

  • user_id: (str), the ID of the desired user

Kwargs:

  • limit: (int) (optional) limits the number of responses returned
  • filter: (list) Filter results that match values contained in the given key separated by a colon
  • sort: (str) Indicates sort order, desc (default) for descending order (newest first) and asc for ascending order (oldest firts)
  • start_date: (str) ISO-8601 formatted date after which to query orders (inclusive)
  • end_date: (str), ISO-8601 formatted date before which to query orders (inclusive)
user_orders = ordering.get_user_orders(user_id='f:123456789:1')

Get Order Events

get_order_events()

Gets events for an order by order ID

Args:

  • order_id: (str), ID of the requested order

Kwargs:

  • limit: (int) (optional) Limits the number of responses returned
  • filter: (list) Filter results that match values contained in the given key separated by a colon
events = ordering.get_order_events('99926034175760632', limit=5, filter="pipeline_id:imagery/analysis-ready")

Get All Pipelines

get_all_pipelines()

Returns a list of all available pipelines

all_pipelines = ordering.get_all_pipelines()

Get Pipeline Details

get_pipeline_details()

Gets the details for a pipeline by namespace and name

Args:

  • namespace: (str) A group of pipelines (e.g. 'imagery')
  • name: (str) Name of the pipeline to order from (e.g. 'analysis-ready')
details = ordering.get_pipeline_details('imagery', 'analysis-ready')