Simple REST APIs for charts and datasets

Make a call to a URL ☎️ AND get back a chart

The Plotly V2 API suite is a simple alternative to the Google Charts API. Make a request to a Plotly URL and get a link to a dataset or D3.js chart.

Sensitive data? Consider Plotly On-Premise or an enterprise-grade cloud plan.


CONTENTS

Example 1: Create a Grid with 2 Columns
Example 2: Create a Bar Chart with 3 Bars
Example 3: List all of your files
Example 4: Add a Row to a Grid
Example 5: Get an Image of a Chart
Example 6: Delete a File
Example 7: Overwrite a Plot

Example 1: Create a grid with 2 columns

☎️ Calling the https://api.plot.ly/v2/grids endpoint.

SHELL (USING CURL)

Get your Plotly username and API key: https://plot.ly/settings/api

USING Python

Get your Plotly username and API key: https://plot.ly/settings/api

USING MATLAB

Get your Plotly username and API key: https://plot.ly/settings/api

USING R

Get your Plotly username and API key: https://plot.ly/settings/api

THE RESPONSE!

? Link to the resulting Grid: https://plot.ly/~private_plotly/60.embed

grid_response


EXAMPLE 2: Create a bar chart with 3 bars

Calling the https://api.plot.ly/v2/plots endpoint.

Notice that data for a Plot must come from columns of Grid(s) that are already saved on Plotly. When you create a Grid, the unique identifiers for the Grid and column are returned in the response (see Example 1: Create a Grid with 2 Columns). You then use these identifiers as inputs for the chart data when creating a Plot.

Plot data, layout, and styling attributes are defined by Plotly’s open JSON specification.

SHELL (USING CURL)

Get your Plotly username and API key: https://plot.ly/settings/api

USING PYTHON

Get your Plotly username and API key: https://plot.ly/settings/api

USING MATLAB

Get your Plotly username and API key: https://plot.ly/settings/api

USING R

Get your Plotly username and API key: https://plot.ly/settings/api

THE RESPONSE!

? Link to the resulting Bar Chart: https://plot.ly/~private_plotly/64.embed

grid_response


Example 3: List all of your files

☎️ Calling the https://api.plot.ly/v2/folders endpoint.

SHELL (USING CURL)

Get your Plotly username and API key: https://plot.ly/settings/api

USING PYTHON

Get your Plotly username and API key: https://plot.ly/settings/api

USING MATLAB

Get your Plotly username and API key: https://plot.ly/settings/api

USING R

Get your Plotly username and API key: https://plot.ly/settings/api

Example 4: Add a Row to a Grid

☎️ Calling the https://api.plot.ly/v2/grids endpoint.

SHELL (USING CURL)

Get your Plotly username and API key: https://plot.ly/settings/api

USING PYTHON

Get your Plotly username and API key: https://plot.ly/settings/api

USING MATLAB

Get your Plotly username and API key: https://plot.ly/settings/api

USING R

Get your Plotly username and API key: https://plot.ly/settings/api

THE RESPONSE!

? Link to the resulting Grid Chart: https://plot.ly/~private_plotly/68.embed

grid_response


EXAMPLE 5: Get an Image of a Chart

Calling the https://api.plot.ly/v2/images endpoint.

The images endpoint is responsible for converting a plot into any desired and specified form. If the request is successful (200 OK) then the raw base64 encoded image of the plot will be contained in the body of the response.

SHELL (USING CURL)

Get your Plotly username and API key: https://plot.ly/settings/api

USING PYTHON

Get your Plotly username and API key: https://plot.ly/settings/api

USING MATLAB

Get your Plotly username and API key: https://plot.ly/settings/api

USING R

Get your Plotly username and API key: https://plot.ly/settings/api

THE RESPONSE!

? Decode the base64 string and create a .png image:

grid_response

EXAMPLE 6: Delete a File

Calling the https://api.plot.ly/v2/files endpoint.

The files endpoint can permanently delete a file or only put it in the trash where it is recoverable. This example demonstrates the latter.

SHELL (USING CURL)

Get your Plotly username and API key: https://plot.ly/settings/api

USING PYTHON

Get your Plotly username and API key: https://plot.ly/settings/api

USING MATLAB

Get your Plotly username and API key: https://plot.ly/settings/api

USING R

Get your Plotly username and API key: https://plot.ly/settings/api

THE RESPONSE!

? Check out the 404 message for the deleted file: https://plot.ly/~private_plotly/62.embed

EXAMPLE 7: Overwrite a File

Calling the https://api.plot.ly/v2/grids endpoint.

Let us overwrite the grid column entries from Example 1.

SHELL (USING CURL)

Get your Plotly username and API key: https://plot.ly/settings/api

USING PYTHON

Get your Plotly username and API key: https://plot.ly/settings/api

USING MATLAB

Get your Plotly username and API key: https://plot.ly/settings/api

USING R

Get your Plotly username and API key: https://plot.ly/settings/api

THE RESPONSE!

? Link to the resulting overwritten Grid Chart: https://plot.ly/~private_plotly/70.embed

grid_response


modern.data