November 3rd, 2021 12:00 PM EDT
Automation for Field Services & DistributionNovember 3rd, 2021 12:00 PM EDT
Learn how creating a digital workforce can improve your supply chain processes!

HTTP API robot

Get the code and run this example in your favorite editor on our Portal!

SpaceX logo

This simple software robot fetches and logs the latest launch data from SpaceX API using RPA Framework.

RPA Framework version 11.4.0 or newer is recommended!

Robot script

*** Settings ***
Documentation     HTTP API robot. Retrieves data from SpaceX API. Demonstrates
...               how to use RPA.HTTP (get response, validate response status,
...               get response as JSON, access JSON properties, etc.).
Library           RPA.HTTP
Library           RPA.core.notebook

*** Variables ***
${SPACEX_API_LATEST_LAUNCHES_URL}=    https://api.spacexdata.com/v4/launches/latest

*** Keywords ***
Log latest launch
    ${launch}=    Get latest launch
    Log info    ${launch}

*** Keywords ***
Get latest launch
    ${response}=    GET    ${SPACEX_API_LATEST_LAUNCHES_URL}
    Request Should Be Successful
    Status Should Be    200
    [Return]    ${response}

*** Keywords ***
Log info
    [Arguments]    ${response}
    ${launch}=    Set Variable    ${response.json()}
    Notebook Print    ${launch}
    Log    ${launch}
    Notebook Print    ${launch["name"]}
    Log    ${launch["name"]}
    Notebook Print    ${launch["links"]["reddit"]["campaign"]}
    Log    ${launch["links"]["reddit"]["campaign"]}

*** Tasks ***
Log latest launch info
    Log latest launch

Example response:

  "fairings": { "reused": true, "recovery_attempt": true, "recovered": true, "ships": ["60c8c7a45d4819007ea69871"] },
  "links": {
    "patch": { "small": "https://imgur.com/IJWn9pK.png", "large": "https://imgur.com/u49XVx4.png" },
    "reddit": {
      "campaign": "https://www.reddit.com/r/spacex/comments/nz7rai/transporter2_launch_campaign_thread/",
      "launch": "https://www.reddit.com/r/spacex/comments/o9ki7u/rspacex_transporter2_launch_discussion_and/",
      "media": null,
      "recovery": "https://www.reddit.com/r/spacex/comments/k2ts1q/rspacex_fleet_updates_discussion_thread/"
    "flickr": {
      "small": [],
      "original": [
    "presskit": null,
    "webcast": "https://youtu.be/sSiuW1HcGjA",
    "youtube_id": "sSiuW1HcGjA",
    "article": null,
    "wikipedia": null
  "static_fire_date_utc": "2021-06-22T15:24:00.000Z",
  "static_fire_date_unix": 1624375440,
  "tbd": false,
  "net": false,
  "window": 0,
  "rocket": "5e9d0d95eda69973a809d1ec",
  "success": true,
  "details": "Falcon 9 launches to sun-synchronous polar orbit from Florida as part of SpaceX's Rideshare program dedicated to smallsat customers. The mission lifts off from SLC-40, Cape Canaveral on a southward azimuth and performs a dogleg maneuver. The booster for this mission is expected to return to LZ-1 based on FCC communications filings. This rideshare takes approximately 90 satellites and hosted payloads into orbit on a variety of deployers including three free-flying spacecraft which dispense their customers' satellites after separation from the SpaceX stack.",
  "ships": ["60c8c7a45d4819007ea69871"],
  "capsules": [],
  "payloads": ["608ac397eb3e50044e3630e7"],
  "launchpad": "5e9e4501f509094ba4566f84",
  "auto_update": true,
  "launch_library_id": "5d248abe-17ef-43ce-9c04-aef33af40520",
  "failures": [],
  "crew": [],
  "flight_number": 132,
  "name": "Transporter-2",
  "date_utc": "2021-06-30T19:31:00.000Z",
  "date_unix": 1625081460,
  "date_local": "2021-06-30T15:31:00-04:00",
  "date_precision": "hour",
  "upcoming": false,
  "cores": [
      "core": "5ef670f10059c33cee4a826c",
      "flight": 8,
      "gridfins": true,
      "legs": true,
      "reused": true,
      "landing_attempt": true,
      "landing_success": true,
      "landing_type": "RTLS",
      "landpad": "5e9e3032383ecb267a34e7c7"
  "id": "600f9b6d8f798e2a4d5f979f"

Learn more about the libraries mentioned on this page:

October 21, 2021