Skip to content
Vasilis Georgitzikis edited this page Jul 24, 2013 · 16 revisions

Request

There are 4 main keys in the JSON request body:

  • files
  • format
  • version
  • build

files

files contains an array of the files to be compiled, with one record for each file. Each file is represented as a key-value array itself, with the filename key containing the filename and the content key containing the code.

For example, to represent a single file named myfile and containing the code printf(300);, its representation would be:

{"filename":"myfile","content":"printf(300);"}

and the files key would contain:

[{"filename":"myfile","content":"printf(300);"}]

format

format contains the output format you would like to request from the compiler. The valid options are:

  • syntax
  • binary
  • object
  • elf
  • hex

version

version contains the Arduino SDK version that your code will be built with. Valid options are 100, 101, 102, 103, 104 and 105 for Arduino versions 1.0.0-1.0.5 respectively.

build

last but not least, build contains the build parameters for the selected board configuration, which the ones found in the originial boards.txt configuration files under the boardname.build.* parameters. The parameters you need to specify are:

  • mcu
  • f_cpu
  • core
  • variant
  • vid optional, for Leonardo-like USB-enabled devices
  • pid (optional, for Leonardo-like USB-enabled devices)

Example

Here's an example of the JSON request for verifying (syntax check) a 2-file sketch for Arduino UNO.

{
   "files":[
      {
         "filename":"hello.h",
         "content":"#define HELLO"
      },
      {
         "filename":"hello.ino",
         "content":"void setup()\n{\n\tint bla, blabla = 5;\n}\n\nvoid loop()\n{\n\n}\n"
      }
   ],
   "format":"syntax",
   "version":"105",
   "build":{
      "mcu":"atmega328p",
      "f_cpu":"16000000L",
      "core":"arduino",
      "variant":"standard"
   }
}

Response

Coming Soon™

Clone this wiki locally