diff --git a/index.php b/index.php index 87b73ef4..c886a6cc 100755 --- a/index.php +++ b/index.php @@ -13,15 +13,50 @@ use PHPDraft\Parse\ApibToJson; use PHPDraft\Parse\JsonToHTML; -if($argc < 1) +$options = getopt("f:t::i::h"); +if(!isset($argv[1])) { - file_put_contents('php://stderr', "Missing file to parse\n"); - exit(2); + file_put_contents('php://stderr', 'Not enough arguments'.PHP_EOL); + help(); + exit(1); } -$apib = new ApibFileParser($argv[1]); +if (boolval(preg_match('/^\-/',$argv[1]))) +{ + if (isset($options['h'])) + { + help(); + exit(0); + } + elseif (isset($options['f'])) + { + $file = $options['f']; + } + else + { + file_put_contents('php://stderr', 'No file to parse'.PHP_EOL); + exit(1); + } +} +else +{ + $file = $argv[1]; +} + +$template = (isset($options['t']) && $options['t']) ? $options['t']: 'default'; +$image = (isset($options['i']) && $options['i']) ? $options['i']: NULL; + +$apib = new ApibFileParser($file); $json = new ApibToJson($apib); -$json->parseToJson(); -$html = new JsonToHTML($json); -$html->get_html(); +$html = new JsonToHTML($json->parseToJson()); +$html->get_html($template, $image); + +function help() +{ + echo 'This is a parser for API Blueprint files in PHP.'.PHP_EOL.PHP_EOL; + echo "The following options can be used:.\n"; + echo "\t-f\tSpecifies the file to parse.\n"; + echo "\t-t\tSpecifies the template to use. (defaults to 'default')\n"; + echo "\t-h\tDisplays this text.\n"; +} ?> diff --git a/src/PHPDraft/In/ApibFileParser.php b/src/PHPDraft/In/ApibFileParser.php index 7411b259..11ab555f 100644 --- a/src/PHPDraft/In/ApibFileParser.php +++ b/src/PHPDraft/In/ApibFileParser.php @@ -30,6 +30,7 @@ class ApibFileParser public function __construct($filename = 'index.apib') { $this->location = pathinfo($filename, PATHINFO_DIRNAME) . '/'; + $this->full_apib = $this->get_apib($filename); } @@ -43,6 +44,7 @@ public function __construct($filename = 'index.apib') */ function get_apib($filename) { + $this->file_check($filename); $file = file_get_contents($filename); $matches = []; preg_match_all('', $file, $matches); @@ -53,6 +55,15 @@ function get_apib($filename) return $file; } + private function file_check($filename) + { + if(!file_exists($filename)) + { + file_put_contents('php://stderr', "API File not found: $filename\n"); + exit(1); + } + } + /** * Return the value of the class * diff --git a/src/PHPDraft/Model/DataStructureElement.php b/src/PHPDraft/Model/DataStructureElement.php index 4d785d73..a4c5b3f6 100644 --- a/src/PHPDraft/Model/DataStructureElement.php +++ b/src/PHPDraft/Model/DataStructureElement.php @@ -128,7 +128,7 @@ function __toString() $return = ''; foreach ($this->value as $object) { - if (get_class($object) === self::class || get_class($object) === ArrayStructureElement::class) + if (is_string($object) || get_class($object) === self::class || get_class($object) === ArrayStructureElement::class) { $return .= $object; } diff --git a/src/PHPDraft/Out/HTML/default.css b/src/PHPDraft/Out/HTML/default.css index 92e4657b..2297d24e 100644 --- a/src/PHPDraft/Out/HTML/default.css +++ b/src/PHPDraft/Out/HTML/default.css @@ -42,7 +42,9 @@ h4.response.error var { padding: 6px 0; } -body .col-md-10 h2:first-of-type { +body .col-md-10 h2:first-child, +body .col-md-10 h3:first-child +{ margin-top: 0; } diff --git a/src/PHPDraft/Out/HTML/default.php b/src/PHPDraft/Out/HTML/default.php index 6544cd21..581c41d2 100644 --- a/src/PHPDraft/Out/HTML/default.php +++ b/src/PHPDraft/Out/HTML/default.php @@ -101,8 +101,12 @@ class="pull-right get_method_icon($transition->get_method()); ?>">
-

title; ?>

-

description; ?>

+ title)):?> +

title; ?>

+ + description)):?> +

description; ?>

+ children as $resource): ?>

title; ?> diff --git a/src/PHPDraft/Out/TemplateGenerator.php b/src/PHPDraft/Out/TemplateGenerator.php index 9c381d89..78d41977 100644 --- a/src/PHPDraft/Out/TemplateGenerator.php +++ b/src/PHPDraft/Out/TemplateGenerator.php @@ -26,6 +26,12 @@ class TemplateGenerator */ protected $template; + /** + * The image to use as a logo + * @var string + */ + protected $image; + /** * The base URl of the API * @var @@ -42,10 +48,12 @@ class TemplateGenerator * TemplateGenerator constructor. * * @param string $template name of the template to load + * @param string $image Image to use as Logo */ - public function __construct($template) + public function __construct($template, $image) { $this->template = $template; + $this->image = $image; } /** @@ -57,6 +65,27 @@ public function __construct($template) */ public function get($object) { + $include = NULL; + if (stream_resolve_include_path($this->template . DIRECTORY_SEPARATOR . $this->template . '.php')) + { + $include = $this->template . DIRECTORY_SEPARATOR . $this->template . '.php'; + } + + if (stream_resolve_include_path($this->template . '.php')) + { + $include = $this->template . '.php'; + } + + if (stream_resolve_include_path('PHPDraft/Out/HTML/' . $this->template . '.php')) + { + $include = 'PHPDraft/Out/HTML/' . $this->template . '.php'; + } + if ($include === NULL) + { + file_put_contents('php://stderr', "Couldn't find template '$this->template'\n"); + exit(1); + } + //Prepare base data if (is_array($object->content[0]->content)) { @@ -64,13 +93,6 @@ public function get($object) { $this->base_data[$meta->content->key->content] = $meta->content->value->content; } - - $this->base_data['TITLE'] = $object->content[0]->meta->title; - } - - //Parse specific data - if (is_array($object->content[0]->content)) - { foreach ($object->content[0]->content as $value) { if ($value->element === 'copy') @@ -88,9 +110,11 @@ public function get($object) $this->base_structures = $cat->structures; } } + + $this->base_data['TITLE'] = $object->content[0]->meta->title; } - include_once 'PHPDraft/Out/HTML/' . $this->template . '.php'; + include_once $include; } /** diff --git a/src/PHPDraft/Parse/ApibToJson.php b/src/PHPDraft/Parse/ApibToJson.php index fa561ddf..190b3ab5 100644 --- a/src/PHPDraft/Parse/ApibToJson.php +++ b/src/PHPDraft/Parse/ApibToJson.php @@ -29,7 +29,7 @@ class ApibToJson * * @var string */ - protected $json; + public $json; /** * ApibToJson constructor. @@ -58,14 +58,38 @@ public function parseToJson() } file_put_contents($tmp_dir . '/index.apib', $this->apib); - if (!$this->drafter_location()) { + if (!$this->drafter_location()) + { file_put_contents('php://stderr', "Drafter was not installed!\n"); exit(1); } - shell_exec($this->drafter_location(). ' ' . $tmp_dir . '/index.apib -f json -o ' . $tmp_dir . '/index.json 2> /dev/null'); - $this->json = file_get_contents($tmp_dir . '/index.json'); - return $this->apib; + shell_exec($this->drafter_location() . ' ' . $tmp_dir . '/index.apib -f json -o ' . $tmp_dir . '/index.json 2> /dev/null'); + $this->json = json_decode(file_get_contents($tmp_dir . '/index.json')); + if (json_last_error() !== JSON_ERROR_NONE) + { + file_put_contents('php://stderr', "Drafter generated invalid JSON!\n" . json_last_error_msg() . "\n"); + file_put_contents('php://stdout', file_get_contents($tmp_dir . '/index.json') . "\n"); + exit(2); + } + $warnings = FALSE; + foreach ($this->json->content as $item) + { + if ($item->element === 'annotation') + { + $warnings = TRUE; + $prefix = strtoupper($item->meta->classes[0]); + $error = $item->content; + file_put_contents('php://stdout', "$prefix: $error\n"); + } + } + if ($warnings) + { + file_put_contents('php://stderr', "Parsing encountered errors and stopped\n"); + exit(2); + } + + return $this->json; } /** @@ -73,20 +97,12 @@ public function parseToJson() * * @return bool|string */ - function drafter_location() { + function drafter_location() + { $returnVal = shell_exec('which drafter 2> /dev/null'); $returnVal = preg_replace('/^\s+|\n|\r|\s+$/m', '', $returnVal); - return (empty($returnVal) ? FALSE : $returnVal); - } - /** - * JSON representation - * - * @return string - */ - function __toString() - { - return $this->json; + return (empty($returnVal) ? FALSE : $returnVal); } } \ No newline at end of file diff --git a/src/PHPDraft/Parse/JsonToHTML.php b/src/PHPDraft/Parse/JsonToHTML.php index 15a86e4a..4c7c6693 100644 --- a/src/PHPDraft/Parse/JsonToHTML.php +++ b/src/PHPDraft/Parse/JsonToHTML.php @@ -26,30 +26,33 @@ class JsonToHTML */ public function __construct($json) { - $this->object = json_decode($json); + $this->object = $json; } /** - * Get the HTML representation of the JSON object - * - * @param string $template Type of template to display. + * Gets the default template HTML * - * @return string HTML template to display + * @return string */ - public function get_html($template = 'default') + function __toString() { - $gen = new TemplateGenerator($template); - return $gen->get($this->object); + return $this->get_html(); } /** - * Gets the default template HTML - * - * @return string + * Get the HTML representation of the JSON object + * + * @param string $template Type of template to display. + * + * @param string $image Image to use as a logo + * + * @return string HTML template to display */ - function __toString() + public function get_html($template = 'default', $image = NULL) { - return $this->get_html(); + $gen = new TemplateGenerator($template, $image); + + return $gen->get($this->object); } } \ No newline at end of file diff --git a/src/PHPDraft/Parse/Tests/ApibToJsonTest.php b/src/PHPDraft/Parse/Tests/ApibToJsonTest.php index e2fe0da7..948cc096 100644 --- a/src/PHPDraft/Parse/Tests/ApibToJsonTest.php +++ b/src/PHPDraft/Parse/Tests/ApibToJsonTest.php @@ -75,4 +75,15 @@ public function testParseToJSON() $this->assertJsonStringEqualsJsonFile(TEST_STATICS.'/json', $this->class->__toString()); } + /** + * Check if parsing the APIB to JSON gives the expected result + */ + public function testParseToJSONWithErrors() + { + $property = $this->reflection->getProperty('apib'); + $property->setAccessible(TRUE); + $property->setValue($this->class, file_get_contents(TEST_STATICS . '/apib_errors')); + $this->class->parseToJson(); + $this->assertJsonStringEqualsJsonFile(TEST_STATICS.'/json_errors', $this->class->__toString()); + } } diff --git a/src/PHPDraft/Parse/Tests/JsonToHTMLTest.php b/src/PHPDraft/Parse/Tests/JsonToHTMLTest.php index 0012a85d..c8235cf9 100644 --- a/src/PHPDraft/Parse/Tests/JsonToHTMLTest.php +++ b/src/PHPDraft/Parse/Tests/JsonToHTMLTest.php @@ -54,13 +54,4 @@ public function testSetupCorrectly() $this->assertEquals(json_decode(file_get_contents(TEST_STATICS . '/json')), $property->getValue($this->class)); } - /** - * Tests if the outputted HTM is as expected. - */ - public function testParseToHTML() - { - $this->expectOutputString(file_get_contents(TEST_STATICS.'/html')); - $this->class->get_html(); - } - } diff --git a/tests/statics/apib_errors b/tests/statics/apib_errors new file mode 100644 index 00000000..cc3b56ee --- /dev/null +++ b/tests/statics/apib_errors @@ -0,0 +1,712 @@ +FORMAT: 1A +HOST: https://owner-api.teslamotors.com + +# Tesla Model S JSON API +This is unofficial documentation of the Tesla Model S JSON API used by the iOS and Android apps. It features functionality to monitor and control the Model S remotely. + +# Group Authentication + +## Tokens [/oauth/token] + +### Get an Access Token [JOKE] +Performs the login. Takes in an plain text email and password, matching the owner's login information for [https://my.teslamotors.com/user/login](https://my.teslamotors.com/user/login). + +Returns a `access_token` which is passed along as a header with all future requests to authenticate the user. + +You must provide the `Authorization: Bearer {access_token}` header in all other requests. + +The current client ID and secret are [available here](http://pastebin.com/fX6ejAHd) + ++ Attributes + + grant_type: `password` (string) - The type of oAuth grant. Always "password" + + client_id: `abc` (string) - The oAuth client ID + + client_secret: `123` (string) - The oAuth client secret + + email: `elon@teslamotors.com` (string) - The email for my.teslamotors.com + + password: `edisonsux` (string) - The password for my.teslamotors.com + ++ Response 200 (application/json) + + Body + + { + "access_token": "abc123", + "token_type": "bearer", + "expires_in": 7776000, + "created_at": 1457385291 + } + +# Group Vehicles +A logged in user can have multiple vehicles under their account. This resource is primarily responsible for listing the vehicles and the basic details about them. + +## Vehicle Collection [/api/1/vehicles] + +### List all Vehicles [GET] +Retrieve a list of your owned vehicles (includes vehicles not yet shipped!) + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Response 200 (application/json) + + + Body + + { + "response": [{ + "color": null, + "display_name": null, + "id": 321, + "option_codes": "MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013", + "user_id": 123, + "vehicle_id": 1234567890, + "vin": "5YJSA1CN5CFP01657", + "tokens": ["x", "x"], + "state": "online" + }], + "count":1 + } + + +## State and Settings [/api/1/vehicles/{vehicle_id}] +These resources are read-only and determine the state of the vehicle's various sub-systems. + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + +## Mobile Access [GET /api/1/vehicles/{vehicle_id}/mobile_enabled] +Determines if mobile access to the vehicle is enabled. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": true + } + +## Charge State [GET /api/1/vehicles/{vehicle_id}/data_request/charge_state] +Returns the state of charge in the battery. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "charging_state": "Complete", // "Charging", ?? + "charge_to_max_range": false, // current std/max-range setting + "max_range_charge_counter": 0, + "fast_charger_present": false, // connected to Supercharger? + "battery_range": 239.02, // rated miles + "est_battery_range": 155.79, // range estimated from recent driving + "ideal_battery_range": 275.09, // ideal miles + "battery_level": 91, // integer charge percentage + "battery_current": -0.6, // current flowing into battery + "charge_starting_range": null, + "charge_starting_soc": null, + "charger_voltage": 0, // only has value while charging + "charger_pilot_current": 40, // max current allowed by charger & adapter + "charger_actual_current": 0, // current actually being drawn + "charger_power": 0, // kW (rounded down) of charger + "time_to_full_charge": null, // valid only while charging + "charge_rate": -1.0, // float mi/hr charging or -1 if not charging + "charge_port_door_open": true + } + } + +## Climate Settings [GET /api/1/vehicles/{vehicle_id}/data_request/climate_state] +Returns the current temperature and climate control state. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "inside_temp": 17.0, // degC inside car + "outside_temp": 9.5, // degC outside car or null + "driver_temp_setting": 22.6, // degC of driver temperature setpoint + "passenger_temp_setting": 22.6, // degC of passenger temperature setpoint + "is_auto_conditioning_on": false, // apparently even if on + "is_front_defroster_on": null, // null or boolean as integer? + "is_rear_defroster_on": false, + "fan_status": 0 // fan speed 0-6 or null + } + } + +## Driving and Position [GET /api/1/vehicles/{vehicle_id}/data_request/drive_state] +Returns the driving and position state of the vehicle. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "shift_state": null, // + "speed": null, // + "latitude": 33.794839, // degrees N of equator + "longitude": -84.401593, // degrees W of the prime meridian + "heading": 4, // integer compass heading, 0-359 + "gps_as_of": 1359863204 // Unix timestamp of GPS fix + } + } + +## GUI Settings [GET /api/1/vehicles/{vehicle_id}/data_request/gui_settings] +Returns various information about the GUI settings of the car, such as unit format and range display. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "gui_distance_units": "mi/hr", + "gui_temperature_units": "F", + "gui_charge_rate_units": "mi/hr", + "gui_24_hour_time": false, + "gui_range_display": "Rated" + } + } + +## Vehicle State [GET /api/1/vehicles/{vehicle_id}/data_request/vehicle_state] +Returns the vehicle's physical state, such as which doors are open. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "df": false, // driver's side front door open + "dr": false, // driver's side rear door open + "pf": false, // passenger's side front door open + "pr": false, // passenger's side rear door open + "ft": false, // front trunk is open + "rt": false, // rear trunk is open + "car_verson": "1.19.42", // car firmware version + "locked": true, // car is locked + "sun_roof_installed": false, // panoramic roof is installed + "sun_roof_state": "unknown", + "sun_roof_percent_open": 0, // null if not installed + "dark_rims": false, // gray rims installed + "wheel_type": "Base19", // wheel type installed + "has_spoiler": false, // spoiler is installed + "roof_color": "Colored", // "None" for panoramic roof + "perf_config": "Base" + } + } + +# Group Vehicle Commands +These commands alter the vehicles state, and return result (true/false) to indicate success, and if failure reason contains the cause of failure. + +## Wake Up Car [POST /api/1/vehicles/{vehicle_id}/wake_up] +Wakes up the car from the sleep state. Necessary to get some data from the car. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Set Valet Mode [POST /api/1/vehicles/{vehicle_id}/command/set_valet_mode] +Sets valet mode on or off with a PIN to disable it from within the car. Reuses last PIN from previous valet session. +Valet Mode limits the car's top speed to 70MPH and 80kW of acceleration power. It also disables Homelink, Bluetooth and +Wifi settings, and the ability to disable mobile access to the car. It also hides your favorites, home, and work +locations in navigation. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + + on: true (boolean) - Whether to enable or disable valet mode. + + password: 1234 (number) - (optional) A 4 digit PIN code to unlock the car. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Reset Valet PIN [POST /api/1/vehicles/{vehicle_id}/command/reset_valet_pin] +Resets the PIN set for valet mode, if set. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Open Charge Port [POST /api/1/vehicles/{vehicle_id}/command/charge_port_door_open] +Opens the charge port. Does not close the charge port (for now...) + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Set Charge Limit to Standard [POST /api/1/vehicles/{vehicle_id}/command/charge_standard] +Set the charge mode to standard (90% under the new percentage system introduced in 4.5). + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": false, + "reason": "already_standard" + } + } + +## Set Charge Limit to Max Range [POST /api/1/vehicles/{vehicle_id}/command/charge_max_range] +Set the charge mode to max range (100% under the new percentage system introduced in 4.5). Use sparingly! + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": false, + "reason": "already_max_range" + } + } + +## Set Charge Limit [POST /api/1/vehicles/{vehicle_id}/command/set_charge_limit?percent={limit_value}] +Set the charge limit to a custom percentage. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + + limit_value: `75` (number) - The percentage value + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Start Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_start] +Start charging. Must be plugged in, have power available, and not have reached your charge limit. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" // "already_started" if a charge is in progress + } + } + +## Stop Charging [POST /api/1/vehicles/{vehicle_id}/command/charge_stop] +Stop charging. Must already be charging. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" // "not_charging" if a charge was not in progress + } + } + +## Flash Lights [POST /api/1/vehicles/{vehicle_id}/command/flash_lights] +Flash the lights once. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Honk Horn [POST /api/1/vehicles/{vehicle_id}/command/honk_horn] +Honk the horn once. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Unlock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_unlock] +Unlock the car's doors. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Lock Doors [POST /api/1/vehicles/{vehicle_id}/command/door_lock] +Lock the car's doors. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Set Temperature [POST /api/1/vehicles/{vehicle_id}/command/set_temps?driver_temp={driver_degC}&passenger_temp={pass_degC}] +Set the temperature target for the HVAC system. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + + driver_degC: `23.7` (number) - The desired temperature on the driver's side in celcius. + + pass_degC: `18.1` (number) - The desired temperature on the passenger's side in celcius. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Start HVAC System [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_start] +Start the climate control system. Will cool or heat automatically, depending on set temperature. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Stop HVAC System [POST /api/1/vehicles/{vehicle_id}/command/auto_conditioning_stop] +Stop the climate control system. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Move Pano Roof [POST /api/1/vehicles/{vehicle_id}/command/sun_roof_control?state={state}&percent={percent}] +Controls the car's panoramic roof, if installed. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + + state: `open` (enum[string]) + The desired state of the panoramic roof. The approximate percent open values for each state are `open` = 100%, `close` = 0%, `comfort` = 80%, and `vent` = ~15% + + Members + + `open` - Open the roof fully + + `close` - Close the roof completely + + `comfort` - Open to the comfort (80%) setting + + `vent` - Open the roof to the vent (~15%) setting + + `move` - Indicates you will provide a percentage to move the roof. + + percent: `50` (number, optional) - The percentage to move the roof to. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Remote Start [POST /api/1/vehicles/{vehicle_id}/command/remote_start_drive?password={password}] +Start the car for keyless driving. Must start driving within 2 minutes of issuing this request. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + + password: `edisonsux` (string) - The password to the authenticated my.teslamotors.com account. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } + +## Open Trunk/Frunk [POST /api/1/vehicles/{vehicle_id}/command/trunk_open] +Open the trunk or frunk. Currently inoperable. + ++ Request + + Headers + + Authorization: Bearer {access_token} + ++ Parameters + + + vehicle_id: `1` (number) - The id of the Vehicle. + + which_trunk: `rear` (string) - The trunk to open. `rear` is the only one known currently. + ++ Response 200 (application/json) + + + Body + + { + "response": { + "result": true, + "reason": "" + } + } \ No newline at end of file diff --git a/tests/statics/json_errors b/tests/statics/json_errors new file mode 100644 index 00000000..cba7ec7e --- /dev/null +++ b/tests/statics/json_errors @@ -0,0 +1,3399 @@ +{ + "element": "parseResult", + "content": [ + { + "element": "category", + "meta": { + "classes": [ + "api" + ], + "title": "Tesla Model S JSON API" + }, + "attributes": { + "meta": [ + { + "element": "member", + "meta": { + "classes": [ + "user" + ] + }, + "content": { + "key": { + "element": "string", + "content": "FORMAT" + }, + "value": { + "element": "string", + "content": "1A" + } + } + }, + { + "element": "member", + "meta": { + "classes": [ + "user" + ] + }, + "content": { + "key": { + "element": "string", + "content": "HOST" + }, + "value": { + "element": "string", + "content": "https://owner-api.teslamotors.com" + } + } + } + ] + }, + "content": [ + { + "element": "copy", + "content": "This is unofficial documentation of the Tesla Model S JSON API used by the iOS and Android apps. It features functionality to monitor and control the Model S remotely.\n\n" + }, + { + "element": "category", + "meta": { + "classes": [ + "resourceGroup" + ], + "title": "Authentication" + }, + "content": [ + { + "element": "resource", + "meta": { + "title": "Tokens" + }, + "attributes": { + "href": "/oauth/token" + }, + "content": [ + { + "element": "copy", + "content": "### Get an Access Token [JOKE]\n\nPerforms the login. Takes in an plain text email and password, matching the owner's login information for [https://my.teslamotors.com/user/login](https://my.teslamotors.com/user/login).\n\nReturns a `access_token` which is passed along as a header with all future requests to authenticate the user.\n\nYou must provide the `Authorization: Bearer {access_token}` header in all other requests.\n\nThe current client ID and secret are [available here](http://pastebin.com/fX6ejAHd)\n\n" + }, + { + "element": "dataStructure", + "content": [ + { + "element": "object", + "meta": { + "id": "Tokens" + }, + "content": [ + { + "element": "member", + "meta": { + "description": "The type of oAuth grant. Always \"password\"" + }, + "content": { + "key": { + "element": "string", + "content": "grant_type" + }, + "value": { + "element": "string", + "content": "password" + } + } + }, + { + "element": "member", + "meta": { + "description": "The oAuth client ID" + }, + "content": { + "key": { + "element": "string", + "content": "client_id" + }, + "value": { + "element": "string", + "content": "abc" + } + } + }, + { + "element": "member", + "meta": { + "description": "The oAuth client secret" + }, + "content": { + "key": { + "element": "string", + "content": "client_secret" + }, + "value": { + "element": "string", + "content": "123" + } + } + }, + { + "element": "member", + "meta": { + "description": "The email for my.teslamotors.com" + }, + "content": { + "key": { + "element": "string", + "content": "email" + }, + "value": { + "element": "string", + "content": "elon@teslamotors.com" + } + } + }, + { + "element": "member", + "meta": { + "description": "The password for my.teslamotors.com" + }, + "content": { + "key": { + "element": "string", + "content": "password" + }, + "value": { + "element": "string", + "content": "edisonsux" + } + } + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "category", + "meta": { + "classes": [ + "resourceGroup" + ], + "title": "Vehicles" + }, + "content": [ + { + "element": "copy", + "content": "A logged in user can have multiple vehicles under their account. This resource is primarily responsible for listing the vehicles and the basic details about them.\n\n" + }, + { + "element": "resource", + "meta": { + "title": "Vehicle Collection" + }, + "attributes": { + "href": "/api/1/vehicles" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "List all Vehicles" + }, + "content": [ + { + "element": "copy", + "content": "Retrieve a list of your owned vehicles (includes vehicles not yet shipped!)\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "GET" + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": [{\n \"color\": null,\n \"display_name\": null,\n \"id\": 321,\n \"option_codes\": \"MS01,RENA,TM00,DRLH,PF00,BT85,PBCW,RFPO,WT19,IBMB,IDPB,TR00,SU01,SC01,TP01,AU01,CH00,HP00,PA00,PS00,AD02,X020,X025,X001,X003,X007,X011,X013\",\n \"user_id\": 123,\n \"vehicle_id\": 1234567890,\n \"vin\": \"5YJSA1CN5CFP01657\",\n \"tokens\": [\"x\", \"x\"],\n \"state\": \"online\"\n }],\n \"count\":1\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "State and Settings" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "These resources are read-only and determine the state of the vehicle's various sub-systems.\n\n" + }, + { + "element": "transition", + "meta": { + "title": "Mobile Access" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/mobile_enabled", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Determines if mobile access to the vehicle is enabled.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "GET", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": true\n}\n" + } + ] + } + ] + } + ] + }, + { + "element": "transition", + "meta": { + "title": "Charge State" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/data_request/charge_state", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Returns the state of charge in the battery.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "GET", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"charging_state\": \"Complete\", // \"Charging\", ??\n \"charge_to_max_range\": false, // current std/max-range setting\n \"max_range_charge_counter\": 0,\n \"fast_charger_present\": false, // connected to Supercharger?\n \"battery_range\": 239.02, // rated miles\n \"est_battery_range\": 155.79, // range estimated from recent driving\n \"ideal_battery_range\": 275.09, // ideal miles\n \"battery_level\": 91, // integer charge percentage\n \"battery_current\": -0.6, // current flowing into battery\n \"charge_starting_range\": null,\n \"charge_starting_soc\": null,\n \"charger_voltage\": 0, // only has value while charging\n \"charger_pilot_current\": 40, // max current allowed by charger & adapter\n \"charger_actual_current\": 0, // current actually being drawn\n \"charger_power\": 0, // kW (rounded down) of charger\n \"time_to_full_charge\": null, // valid only while charging\n \"charge_rate\": -1.0, // float mi/hr charging or -1 if not charging\n \"charge_port_door_open\": true\n }\n}\n" + } + ] + } + ] + } + ] + }, + { + "element": "transition", + "meta": { + "title": "Climate Settings" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/data_request/climate_state", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Returns the current temperature and climate control state.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "GET", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"inside_temp\": 17.0, // degC inside car\n \"outside_temp\": 9.5, // degC outside car or null\n \"driver_temp_setting\": 22.6, // degC of driver temperature setpoint\n \"passenger_temp_setting\": 22.6, // degC of passenger temperature setpoint\n \"is_auto_conditioning_on\": false, // apparently even if on\n \"is_front_defroster_on\": null, // null or boolean as integer?\n \"is_rear_defroster_on\": false,\n \"fan_status\": 0 // fan speed 0-6 or null\n }\n}\n" + } + ] + } + ] + } + ] + }, + { + "element": "transition", + "meta": { + "title": "Driving and Position" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/data_request/drive_state", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Returns the driving and position state of the vehicle.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "GET", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"shift_state\": null, //\n \"speed\": null, //\n \"latitude\": 33.794839, // degrees N of equator\n \"longitude\": -84.401593, // degrees W of the prime meridian\n \"heading\": 4, // integer compass heading, 0-359\n \"gps_as_of\": 1359863204 // Unix timestamp of GPS fix\n }\n}\n" + } + ] + } + ] + } + ] + }, + { + "element": "transition", + "meta": { + "title": "GUI Settings" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/data_request/gui_settings", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Returns various information about the GUI settings of the car, such as unit format and range display.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "GET", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"gui_distance_units\": \"mi/hr\",\n \"gui_temperature_units\": \"F\",\n \"gui_charge_rate_units\": \"mi/hr\",\n \"gui_24_hour_time\": false,\n \"gui_range_display\": \"Rated\"\n }\n}\n" + } + ] + } + ] + } + ] + }, + { + "element": "transition", + "meta": { + "title": "Vehicle State" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/data_request/vehicle_state", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Returns the vehicle's physical state, such as which doors are open.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "GET", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"df\": false, // driver's side front door open\n \"dr\": false, // driver's side rear door open\n \"pf\": false, // passenger's side front door open\n \"pr\": false, // passenger's side rear door open\n \"ft\": false, // front trunk is open\n \"rt\": false, // rear trunk is open\n \"car_verson\": \"1.19.42\", // car firmware version\n \"locked\": true, // car is locked\n \"sun_roof_installed\": false, // panoramic roof is installed\n \"sun_roof_state\": \"unknown\",\n \"sun_roof_percent_open\": 0, // null if not installed\n \"dark_rims\": false, // gray rims installed\n \"wheel_type\": \"Base19\", // wheel type installed\n \"has_spoiler\": false, // spoiler is installed\n \"roof_color\": \"Colored\", // \"None\" for panoramic roof\n \"perf_config\": \"Base\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "category", + "meta": { + "classes": [ + "resourceGroup" + ], + "title": "Vehicle Commands" + }, + "content": [ + { + "element": "copy", + "content": "These commands alter the vehicles state, and return result (true/false) to indicate success, and if failure reason contains the cause of failure.\n\n" + }, + { + "element": "resource", + "meta": { + "title": "Wake Up Car" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/wake_up" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Wake Up Car" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/wake_up", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Wakes up the car from the sleep state. Necessary to get some data from the car.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Set Valet Mode" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/set_valet_mode" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Set Valet Mode" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/set_valet_mode", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + }, + { + "element": "member", + "meta": { + "description": "Whether to enable or disable valet mode." + }, + "content": { + "key": { + "element": "string", + "content": "on" + }, + "value": { + "element": "boolean", + "content": true + } + } + }, + { + "element": "member", + "meta": { + "description": "(optional) A 4 digit PIN code to unlock the car." + }, + "content": { + "key": { + "element": "string", + "content": "password" + }, + "value": { + "element": "number", + "content": 1234 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Sets valet mode on or off with a PIN to disable it from within the car. Reuses last PIN from previous valet session.\nValet Mode limits the car's top speed to 70MPH and 80kW of acceleration power. It also disables Homelink, Bluetooth and\nWifi settings, and the ability to disable mobile access to the car. It also hides your favorites, home, and work\nlocations in navigation.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Reset Valet PIN" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/reset_valet_pin" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Reset Valet PIN" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/reset_valet_pin", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Resets the PIN set for valet mode, if set.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Open Charge Port" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_port_door_open" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Open Charge Port" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_port_door_open", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Opens the charge port. Does not close the charge port (for now...)\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Set Charge Limit to Standard" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_standard" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Set Charge Limit to Standard" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_standard", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Set the charge mode to standard (90% under the new percentage system introduced in 4.5).\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": false,\n \"reason\": \"already_standard\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Set Charge Limit to Max Range" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_max_range" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Set Charge Limit to Max Range" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_max_range", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Set the charge mode to max range (100% under the new percentage system introduced in 4.5). Use sparingly!\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": false,\n \"reason\": \"already_max_range\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Set Charge Limit" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/set_charge_limit?percent={limit_value}" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Set Charge Limit" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/set_charge_limit?percent={limit_value}", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + }, + { + "element": "member", + "meta": { + "description": "The percentage value" + }, + "content": { + "key": { + "element": "string", + "content": "limit_value" + }, + "value": { + "element": "number", + "content": 75 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Set the charge limit to a custom percentage.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Start Charging" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_start" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Start Charging" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_start", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Start charging. Must be plugged in, have power available, and not have reached your charge limit.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\" // \"already_started\" if a charge is in progress\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Stop Charging" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_stop" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Stop Charging" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/charge_stop", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Stop charging. Must already be charging.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\" // \"not_charging\" if a charge was not in progress\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Flash Lights" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/flash_lights" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Flash Lights" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/flash_lights", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Flash the lights once.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Honk Horn" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/honk_horn" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Honk Horn" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/honk_horn", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Honk the horn once.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Unlock Doors" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/door_unlock" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Unlock Doors" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/door_unlock", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Unlock the car's doors.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Lock Doors" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/door_lock" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Lock Doors" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/door_lock", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Lock the car's doors.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Set Temperature" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/set_temps?driver_temp={driver_degC}&passenger_temp={pass_degC}" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Set Temperature" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/set_temps?driver_temp={driver_degC}&passenger_temp={pass_degC}", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + }, + { + "element": "member", + "meta": { + "description": "The desired temperature on the driver's side in celcius." + }, + "content": { + "key": { + "element": "string", + "content": "driver_degC" + }, + "value": { + "element": "number", + "content": 23.7 + } + } + }, + { + "element": "member", + "meta": { + "description": "The desired temperature on the passenger's side in celcius." + }, + "content": { + "key": { + "element": "string", + "content": "pass_degC" + }, + "value": { + "element": "number", + "content": 18.1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Set the temperature target for the HVAC system.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Start HVAC System" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/auto_conditioning_start" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Start HVAC System" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/auto_conditioning_start", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Start the climate control system. Will cool or heat automatically, depending on set temperature.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Stop HVAC System" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/auto_conditioning_stop" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Stop HVAC System" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/auto_conditioning_stop", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Stop the climate control system.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Move Pano Roof" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/sun_roof_control?state={state}&percent={percent}" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Move Pano Roof" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/sun_roof_control?state={state}&percent={percent}", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + }, + { + "element": "member", + "meta": { + "description": "\nThe desired state of the panoramic roof. The approximate percent open values for each state are `open` = 100%, `close` = 0%, `comfort` = 80%, and `vent` = ~15%\n\n" + }, + "content": { + "key": { + "element": "string", + "content": "state" + }, + "value": { + "element": "enum", + "attributes": { + "samples": [ + [ + { + "element": "string", + "content": "open" + } + ] + ] + }, + "content": [ + { + "element": "string", + "content": "open" + }, + { + "element": "string", + "content": "close" + }, + { + "element": "string", + "content": "comfort" + }, + { + "element": "string", + "content": "vent" + }, + { + "element": "string", + "content": "move" + } + ] + } + } + }, + { + "element": "member", + "meta": { + "description": "The percentage to move the roof to." + }, + "attributes": { + "typeAttributes": [ + "optional" + ] + }, + "content": { + "key": { + "element": "string", + "content": "percent" + }, + "value": { + "element": "number", + "content": 50 + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Controls the car's panoramic roof, if installed.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Remote Start" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/remote_start_drive?password={password}" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Remote Start" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/remote_start_drive?password={password}", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + }, + { + "element": "member", + "meta": { + "description": "The password to the authenticated my.teslamotors.com account." + }, + "content": { + "key": { + "element": "string", + "content": "password" + }, + "value": { + "element": "string", + "content": "edisonsux" + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Start the car for keyless driving. Must start driving within 2 minutes of issuing this request.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "resource", + "meta": { + "title": "Open Trunk/Frunk" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/trunk_open" + }, + "content": [ + { + "element": "transition", + "meta": { + "title": "Open Trunk/Frunk" + }, + "attributes": { + "href": "/api/1/vehicles/{vehicle_id}/command/trunk_open", + "hrefVariables": { + "element": "hrefVariables", + "content": [ + { + "element": "member", + "meta": { + "description": "The id of the Vehicle." + }, + "content": { + "key": { + "element": "string", + "content": "vehicle_id" + }, + "value": { + "element": "number", + "content": 1 + } + } + }, + { + "element": "member", + "meta": { + "description": "The trunk to open. `rear` is the only one known currently." + }, + "content": { + "key": { + "element": "string", + "content": "which_trunk" + }, + "value": { + "element": "string", + "content": "rear" + } + } + } + ] + } + }, + "content": [ + { + "element": "copy", + "content": "Open the trunk or frunk. Currently inoperable.\n\n" + }, + { + "element": "httpTransaction", + "content": [ + { + "element": "httpRequest", + "attributes": { + "method": "POST", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Authorization" + }, + "value": { + "element": "string", + "content": "Bearer {access_token}" + } + } + } + ] + } + }, + "content": [] + }, + { + "element": "httpResponse", + "attributes": { + "statusCode": "200", + "headers": { + "element": "httpHeaders", + "content": [ + { + "element": "member", + "content": { + "key": { + "element": "string", + "content": "Content-Type" + }, + "value": { + "element": "string", + "content": "application/json" + } + } + } + ] + } + }, + "content": [ + { + "element": "asset", + "meta": { + "classes": [ + "messageBody" + ] + }, + "attributes": { + "contentType": "application/json" + }, + "content": "{\n \"response\": {\n \"result\": true,\n \"reason\": \"\"\n }\n}\n" + } + ] + } + ] + } + ] + } + ] + } + ] + } + ] + }, + { + "element": "annotation", + "meta": { + "classes": [ + "warning" + ] + }, + "attributes": { + "code": 5, + "sourceMap": [ + { + "element": "sourceMap", + "content": [ + [ + 1169, + 229 + ] + ] + } + ] + }, + "content": "ignoring unrecognized block" + }, + { + "element": "annotation", + "meta": { + "classes": [ + "warning" + ] + }, + "attributes": { + "code": 3, + "sourceMap": [ + { + "element": "sourceMap", + "content": [ + [ + 1739, + 11 + ] + ] + } + ] + }, + "content": "no headers specified" + }, + { + "element": "annotation", + "meta": { + "classes": [ + "warning" + ] + }, + "attributes": { + "code": 5, + "sourceMap": [ + { + "element": "sourceMap", + "content": [ + [ + 1754, + 37 + ] + ] + } + ] + }, + "content": "ignoring unrecognized block" + }, + { + "element": "annotation", + "meta": { + "classes": [ + "warning" + ] + }, + "attributes": { + "code": 6, + "sourceMap": [ + { + "element": "sourceMap", + "content": [ + [ + 1725, + 67 + ] + ] + } + ] + }, + "content": "empty request message-body" + } + ] +} \ No newline at end of file