Skip to content
  • function makeRequest() as Void {
        System.println("makeRequest");
        var url = "https://url/.....";
    
        var graphqlQuery = "query getData {getDeviceData(vin: \"VID_12345\") {response {unitid}}}";
    
        var headers = {
            "Content-Type" => Communications.REQUEST_CONTENT_TYPE_JSON,
            "Authorization" => "Bearer _accessToken"
        };
    
        var options = {
            :method => Communications.HTTP_REQUEST_METHOD_POST,
            :headers => headers,
            :responseType => Communications.HTTP_RESPONSE_CONTENT_TYPE_JSON
        };
    
        var body = {
            "query" => graphqlQuery
        };
    
        Communications.makeWebRequest(url, body, options, method(:onReceive));
    }
    
    function onReceive(responseCode as Number, data as Dictionary<String, Object?> or String or Null) as Void {
        System.println("onReceive");
        System.println("Response code: " + responseCode.toString());
        WatchUi.requestUpdate();
    }

    this is how am using but it's giving me response code -400, any mistakes ?

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment