8 years, 8 months ago.

Compile API - REST sample

Hi, I'm trying to get started with the Compiler API, but as I'm not a fan of curl I was hoping to use the javascript sample on the page, but it's gone :(

https://github.com/ARMmbed/mbed-configurator

When I try the sample using a pure REST client I get "Sorry, this page is currently unavailable."

POST /api/v2/tasks/compiler/start/ HTTP/1.1
Host: developer.mbed.org
platform: mbed-lpc1768
program: test03
Authorization: Basic [token]
Cache-Control: no-cache

{
    "code": 200,
    "errors": null,
    "warnings": null,
    "meta": null,
    "result": {
        "display_notices": null,
        "data": {
            "task_id": "4356cb76-7df2-458b-9708-705fb62e8280"
        },
        "display_warnings": null,
        "display_errors": null,
        "result_meta": null
    },
    "notices": null
}

Does anyone have a reference to the javascript sample or could share some other sample?

Turns out it was just about setting the content type to application/x-www-form-urlencoded

POST /api/v2/tasks/compiler/start/ HTTP/1.1
Host: developer.mbed.org
Authorization: Basic [Token]
Cache-Control: no-cache
Content-Type: application/x-www-form-urlencoded

platform=mbed-lpc1768&program=test03
posted by Mikael Hakansson 27 Apr 2016
Be the first to answer this question.