Microreact
  • Introduction
  • Introductory Videos
  • About Microreact
    • Privacy and Terms Of Service
    • Open source software used by Microreact
    • Change Log
  • Instructions
    • Navigating the site
      • Managing Projects
    • Navigating within a project
      • History sidebar
      • Selection sidebar
      • Views Sidebar
    • Creating a Project
      • Supported File Formats
      • Metadata Data
      • Tree Data
      • Map Data
      • Timeline Data
      • Network Data
      • Matrix Data
    • Adding and Editing Panels
      • Data Table
      • Map
      • Timeline
      • Tree
      • Network
      • Data-slicer
      • Chart overview
        • Area Chart
        • Line Chart
        • Bar Chart
        • Circle, Tick, Point Charts
        • Custom charts
        • Pie Chart
        • Multi-variable Chart
        • Heatmap
      • Note Panel
      • Matrix
    • Selecting and Filtering Data
    • Labels, Colours, and Shapes
    • Saving and version control
    • Access Control and Project Sharing
      • Download Project Files
      • URL control options
    • Tips & FAQ
      • How to Link Microreact projects to Google Sheets
  • API
    • API Access Tokens
    • Creating Projects via API
    • Updating Projects via API
    • Deleting Projects via API
    • Sharing Projects via API
    • Migrating to the new API
  • Feedback
    • Contact the Microreact team
Powered by GitBook
On this page
  • Summary of breaking changes
  • Converting old API request payload

Was this helpful?

  1. API

Migrating to the new API

This page relates to major changes in Microreact released in 2020

Summary of breaking changes

The new Microreact API only accepts authenticated requests. Calls without an Acccess-Token header will fail with 401 Unauthorized error.

New API
Old API

API Endpoint

https://microreact.org/api/projects/create/

https://microreact.org/api/project/

Documentation

Request body

A valid .microreact JSON file

Old API request payload as documented in https://old.microreact.org/api-docs

Access-Token header

Optional

Converting old API request payload

You can convert an old API request payload to a new .microreact JSON file using the schema convertor endpoint:

curl \
  --header "Content-type: application/json; charset=UTF-8" \
  --request POST \
  --data '{ "name": "hayu110x2c0smcm", "data": "https://raw.githubusercontent.com/microreact/data/main/data.csv" }' \
  https://microreact.org/api/schema/convert

The response is a valid .microreact JSON file

{
  "datasets": {
    "dataset-1": {
      "file": "data-file-1",
      "idFieldName": "id"
    }
  },
  "files": {
    "data-file-1": {
      "id": "data-file-1",
      "format": "text/csv",
      "name": "data.csv",
      "url": "https://raw.githubusercontent.com/microreact/data/main/data.csv"
    }
  },
  "maps": {
    "map-1": {
      "title": "Map",
      "latitudeField": "__latitude",
      "longitudeField": "__longitude"
    }
  },
  "meta": {
    "name": "hayu110x2c0smcm"
  },
  "tables": {
    "table-1": {
      "dataset": "dataset-1",
      "title": "Metadata",
      "columns": [
        {
          "field": "id"
        },
        {
          "field": "__latitude"
        },
        {
          "field": "__longitude"
        },
        {
          "field": "country"
        },
        {
          "field": "__year"
        },
        {
          "field": "__month"
        },
        {
          "field": "__day"
        }
      ]
    }
  },
  "timelines": {
    "timeline-1": {
      "title": "Timeline",
      "dataType": "year-month-day",
      "yearField": "__year",
      "monthField": "__month",
      "dayField": "__day"
    }
  },
  "schema": "https://microreact.org/schema/v1.json"
}

You can also pipe the response into the create project endpoint as in the following example:

curl \
  --header "Content-type: application/json; charset=UTF-8" \
  --request POST \
  --data '{ "name": "hayu110x2c0smcm", "data": "https://raw.githubusercontent.com/microreact/data/main/data.csv" }' \ # Old API request payload as documented in https://old.microreact.org/api-docs 
  https://microreact.org/api/schema/convert \
| \
curl \
  --header "Content-type: application/json; charset=UTF-8" \
  --header "Access-Token: eyJhbGciOiJIUzUxMiJ9..." \ # Obtain your access token from https://microreact.org/my-account/settings
  --data @- \
  https://microreact.org/api/projects/create
PreviousSharing Projects via APINextContact the Microreact team

Last updated 1 year ago

Was this helpful?

Required (Obtain your access token from )

https://docs.microreact.org/api/
https://old.microreact.org/api-docs
https://microreact.org/my-account/settings