Skip to content

Graphql queries #707

@drnic

Description

@drnic

Inspired by the revelation that some of tesla's API is behind graphql in #539 (comment) I went hunting for some other graphql queries.

I found:

{
    "query": "\n    query getChargingVehicles {\n  me {\n    charging {\n      vehicles {\n        vin\n        carType\n        deliveryDate\n        imageUrl\n      }\n    }\n  }\n}\n    ",
    "operationName": "getChargingVehicles"
}
{
    "query": "\n    query getPendingBalances {\n  me {\n    charging {\n      balances {\n        list {\n          amount\n          countryCode\n          currencyCode\n          sessionFeeIds\n        }\n      }\n    }\n  }\n}\n    ",
    "operationName": "getPendingBalances"
}
{
    "query": "\n    query GetInstrumentBySource($paymentSource: PaymentGatewayPaymentSourceEnum!, $countryCode: String, $currencyCode: String) {\n  me {\n    payment {\n      getInstrumentBySource(\n        paymentSource: $paymentSource\n        countryCode: $countryCode\n        currencyCode: $currencyCode\n      ) {\n        expiryMonth\n        expiryYear\n        lastFourDigits\n        paymentChannels\n        paymentInstrumentType\n        accountType\n      }\n    }\n  }\n}\n    ",
    "variables": {
        "paymentSource": "SUPERCHARGE",
        "countryCode": "AU",
        "currencyCode": "AUD"
    },
    "operationName": "GetInstrumentBySource"
}

And the following that was mentioned in #539 (comment)

{
    "query": "\n    query getChargingHistoryV2($pageNumber: Int!, $sortBy: String, $sortOrder: SortByEnum) {\n  me {\n    charging {\n      historyV2(pageNumber: $pageNumber, sortBy: $sortBy, sortOrder: $sortOrder) {\n        data {\n          ...SparkHistoryItemFragment\n        }\n        totalResults\n        hasMoreData\n        pageNumber\n      }\n    }\n  }\n}\n    \n    fragment SparkHistoryItemFragment on SparkHistoryItem {\n  countryCode\n  programType\n  billingType\n  vin\n  isMsp\n  credit {\n    distance\n    distanceUnit\n  }\n  chargingPackage {\n    distance\n    distanceUnit\n    energyApplied\n  }\n  invoices {\n    fileName\n    contentId\n    invoiceType\n  }\n  chargeSessionId\n  siteLocationName\n  chargeStartDateTime\n  chargeStopDateTime\n  unlatchDateTime\n  fees {\n    ...SparkHistoryFeeFragment\n  }\n  vehicleMakeType\n  sessionId\n  surveyCompleted\n  surveyType\n  postId\n  cabinetId\n  din\n}\n    \n    fragment SparkHistoryFeeFragment on SparkHistoryFee {\n  sessionFeeId\n  feeType\n  payorUid\n  amountDue\n  currencyCode\n  pricingType\n  usageBase\n  usageTier1\n  usageTier2\n  usageTier3\n  usageTier4\n  rateBase\n  rateTier1\n  rateTier2\n  rateTier3\n  rateTier4\n  totalTier1\n  totalTier2\n  totalTier3\n  totalTier4\n  uom\n  isPaid\n  uid\n  totalBase\n  totalDue\n  netDue\n  status\n}\n    ",
    "variables": {
        "sortBy": "start_datetime",
        "sortOrder": "DESC",
        "pageNumber": 1
    },
    "operationName": "getChargingHistoryV2"
}

Currently we don't have a reference to any graphql calls in the https://tesla-api.timdorr.com/ site. Does anyone have a favourite way they've seen graphql API's documented; and have a suggestion how they'd appear on the api docs site?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions