Simplest REST API example

Hi there,

I’ve just met Plotly and I think it is great tool which can be of importance in a company I am currently working in. So I’ve decided to check out REST API - my probable use case would be creating data in internal application and then export it to Plotly in order for people to see it/edit/comment/etc.

So I am trying to create simplest ‘Hello world’ example but I am stuck. I was trying to use simple HTML page with jQuery AJAX call to REST API but I stumbled upon CORS/cross-domain SSL issues. Ok, we can skip that. I’ve switched to Fiddler for the sake of simplicity.

I am pasting simple JSON (taken from DOCS, with my login/pass) as request body but I am on and on reciving error message.

Here is the JSON request body taken from Fiddler:

{un: ‘chlebik’, key: ‘MY_API_KEY_TAKEN_FROM_SETTINGS’, origin: ‘plot’, platform: ‘lisp’, args: [[0, 1, 2], [3, 4, 5], [1, 2, 3], [6, 6, 5]],
kwargs: {“filename”: “plot from api”,
“fileopt”: “overwrite”,
“style”: {
“type”: “bar”
“traces”: [1],
“layout”: {
“title”: “experimental data”
“world_readable”: true

Whatever I do I get ‘Missing required POST parameters: platform un key origin args kwargs’ despite the fact that body is recognised by Fiddler as JSON - event JSON-tree is created.

So the question is - am I so tired by now just to miss something obvious or is there some catch I have no idea about?

I tested this using Python, and what worked for me was json-serializing the list for both the args and kwargs keys, but not the entire dictionary.

import requests
import json
payload = {
    'un': 'username',
    'key': 'api_key',
    'origin': 'plot',
    'platform': 'python',
    'args': json.dumps([[0, 1, 2], [3, 4, 5], [1, 2, 3], [6, 6, 5]]),
    'kwargs': json.dumps({"filename": "plot from api",
            "fileopt": "new",
            "style": {
            "type": "bar"
    "traces": [1],
    "layout": {
        "title": "experimental data"
    "world_readable": True
r ='', data=payload)

My understanding is that is depreciated in favor of the API version 2: . Unfortunately, the new api is quite badly documented and I cannot figure out how to create a simple chart in a single http POST.

good luck.