Transaction API

McBAINMcBAIN Member Posts: 2

I spend ages each month splitting transactions between business and personal use percentage, calculating amounts and tax components manually, then manually creating transfer transactions and journal transactions against my business. An API that allowed accessing and modifying transactions would be amazing. How far off adding support for that are you?

Tagged:

Comments

  • SBenoitSBenoit Member Posts: 28 ✭✭

    I'm also interested in this. I'm glad we can (mostly...) create new transactions with GraphQL, but being able to query/mutate existing transactions is the key that I need to automate a lot of the tedious work I do now manually. Any updates on this?

  • PabblyPabbly Member Posts: 7

    Is there an example to create a transaction in Wave account via API call. We have gone through the available examples here: https://developer.waveapps.com/hc/en-us/sections/360006441372-Examples but couldn't find it there.

  • twestricktwestrick Member Posts: 8

    Here is an example:

    // Query
    mutation($input: MoneyTransactionCreateInput!) {
      moneyTransactionCreate(input: $input) {
        didSucceed
        inputErrors {
          code
          path
          message
        }
        transaction {
          id
        }
      }
    }
    
    // Variables
    {
      "input": {
        "businessId": "BUSINESS_ID",
        "externalId": "EXTERNAL_ID",
        "date": "2020-10-13",
        "description": "This is a test money transaction",
        "notes": "And some notes!",
        "anchor": {
          "accountId": "ACCOUNT_ID",
          "amount": 100,
          "direction": "DEPOSIT"
        },
        "lineItems": [
          {
            "accountId": "ACCOUNT_ID",
            "amount": 100,
            "balance": "INCREASE"
          }
        ]
      }
    }
    
  • PabblyPabbly Member Posts: 7


    Still I am getting some error in the Postman

    { "errors": [ { "extensions": { "id": "bc5dc918-dd26-4a3e-ab6a-3ffe1ccc8e90", "code": "VARIABLE_VALUE" }, "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"businessId\" of required type \"ID!\" was not provided.", "locations": [ { "line": 1, "column": 10 } ] }, { "extensions": { "id": "0b6bf2d3-25ca-48f6-8d46-306f7febf9af", "code": "VARIABLE_VALUE" }, "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"id\" is not defined by type \"MoneyTransactionCreateInput\".", "locations": [ { "line": 1, "column": 10 } ] } ] }

    edited November 19, 2020
  • PabblyPabbly Member Posts: 7

    Still not able to make it work

    { "errors": [ { "extensions": { "id": "bc5dc918-dd26-4a3e-ab6a-3ffe1ccc8e90", "code": "VARIABLE_VALUE" }, "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"businessId\" of required type \"ID!\" was not provided.", "locations": [ { "line": 1, "column": 10 } ] }, { "extensions": { "id": "0b6bf2d3-25ca-48f6-8d46-306f7febf9af", "code": "VARIABLE_VALUE" }, "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"id\" is not defined by type \"MoneyTransactionCreateInput\".", "locations": [ { "line": 1, "column": 10 } ] } ] }

  • twestricktwestrick Member Posts: 8

    Try to get it to work using the API Playground. If you can get that to work, then try Postman.

    I do see that your accountId is incorrect. It needs to match what is returned from the chart of accounts using GraphQL (reference).

  • PabblyPabbly Member Posts: 7

    Thanks,

    I tried my best to make it work, the very first step, I retrieved the accounts that you have mentioned above and then passed the same in the request.

    Here is my Postman request.
    curl --location --request POST 'https://gql.waveapps.com/graphql/public' \ --header 'Authorization: Bearer 6lrUnetN59yRNAeKX0baK1q4GLIHOi' \ --header 'Content-Type: application/json' \ --header 'Cookie: _pxvid=7c789e01-a00d-11ea-8c87-f321642b6135; amplitude_34a76f6e38ab182d418e3abcdac0c208waveapps.com=eyJkZXZpY2VJZCI6IjNlMDUyMjQ4LWZjNmItNDg2NC04N2JmLWM1NjUxNWM4ZTRlMFIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYwNTc4ODk1NDQ4MCwibGFzdEV2ZW50VGltZSI6MTYwNTc4ODk3MjA2MiwiZXZlbnRJZCI6MTAsImlkZW50aWZ5SWQiOjAsInNlcXVlbmNlTnVtYmVyIjoxMH0=; identity-csrftoken=oLs7Ea4sQYrDT2RYEoy3zrFgrgU7BrbVXuDFEYKwUX2ewPiV2wLXeCRhZlaFNFVa; __cfduid=dc914e4b8df1c222f71c26533670097141607423241' \ --data-raw '{ "query": "mutation($input: MoneyTransactionCreateInput!) { moneyTransactionCreate(input: $input) { didSucceed inputErrors { code path message } transaction { id }}}", "variables": { "input": { "id": "QnVzaW5lc3M6ODc5NTExMGQtN2M1YS00OGRkLWFkMmUtYzZmNWIwYjQ1NTVk", "externalId": "uuid", "date": "2020-11-29", "description": "my money", "anchor": { "accountId": "QWNjb3VudDo5NTM0NDA1MTE5Nzk0NDY4MTg7QnVzaW5lc3M6ODc5NTExMGQtN2M1YS00OGRkLWFkMmUtYzZmNWIwYjQ1NTVk", "amount": "15.00", "direction": "DEPOSIT" }, "lineItems": [ { "accountId": "QWNjb3VudDo5NTM0NDA1MTE5Nzk0NDY4MTg7QnVzaW5lc3M6ODc5NTExMGQtN2M1YS00OGRkLWFkMmUtYzZmNWIwYjQ1NTVk", "amount": 100, "balance": "INCREASE" } ] } } }'
    Can you please look into that once. What I am missing to pass?

  • PabblyPabbly Member Posts: 7

    Thanks for sharing the Accounts Endpoint,

    I tried the same in Postman and passed the Account ID in the above query but still the response is same.
    Here is my request -

    curl --location --request POST 'https://gql.waveapps.com/graphql/public' \ --header 'Authorization: Bearer 6lrUnetN59yRNAeKX0baK1q4GLIHOi' \ --header 'Content-Type: application/json' \ --header 'Cookie: _pxvid=7c789e01-a00d-11ea-8c87-f321642b6135; amplitude_34a76f6e38ab182d418e3abcdac0c208waveapps.com=eyJkZXZpY2VJZCI6IjNlMDUyMjQ4LWZjNmItNDg2NC04N2JmLWM1NjUxNWM4ZTRlMFIiLCJ1c2VySWQiOm51bGwsIm9wdE91dCI6ZmFsc2UsInNlc3Npb25JZCI6MTYwNTc4ODk1NDQ4MCwibGFzdEV2ZW50VGltZSI6MTYwNTc4ODk3MjA2MiwiZXZlbnRJZCI6MTAsImlkZW50aWZ5SWQiOjAsInNlcXVlbmNlTnVtYmVyIjoxMH0=; identity-csrftoken=oLs7Ea4sQYrDT2RYEoy3zrFgrgU7BrbVXuDFEYKwUX2ewPiV2wLXeCRhZlaFNFVa; __cfduid=dc914e4b8df1c222f71c26533670097141607423241' \ --data-raw '{ "query": "mutation($input: MoneyTransactionCreateInput!) { moneyTransactionCreate(input: $input) { didSucceed inputErrors { code path message } transaction { id }}}", "variables": { "input": { "id": "QnVzaW5lc3M6ODc5NTExMGQtN2M1YS00OGRkLWFkMmUtYzZmNWIwYjQ1NTVk", "externalId": "uuid", "date": "2020-11-29", "description": "my money", "anchor": { "accountId": "QWNjb3VudDo5NTM0NDA1MTE5Nzk0NDY4MTg7QnVzaW5lc3M6ODc5NTExMGQtN2M1YS00OGRkLWFkMmUtYzZmNWIwYjQ1NTVk", "amount": "15.00", "direction": "DEPOSIT" }, "lineItems": [ { "accountId": "QWNjb3VudDo5NTM0NDA1MTE5Nzk0NDY4MTg7QnVzaW5lc3M6ODc5NTExMGQtN2M1YS00OGRkLWFkMmUtYzZmNWIwYjQ1NTVk", "amount": 100, "balance": "INCREASE" } ] } } }'

    Can you please look into this once and let me know where I am wrong?

  • twestricktwestrick Member Posts: 8

    This is how I am doing it in Postman. Also, you copied and pasted your Auth Bearer token. Anyone can now use that to query against your Wave account. Make sure you get that changed.

  • EddieVEddieV Member Posts: 2
    I'm a newbie to Waves API. I believe I understand the context of this question. Can someone confirm that you're able to code/categorize transactions outside of Wave and update Wave with the categorized transactions?
  • twestricktwestrick Member Posts: 8

    @EddieV unfortunately right now Wave only lets you create transactions through their API. There is no way to get or edit existing transactions. I can't wait for them to add this functionality as it really limits what we can do with the API.

  • PabblyPabbly Member Posts: 7

    Still not able to make it work

    {
    "errors": [
    {
    "extensions": {
    "id": "bc5dc918-dd26-4a3e-ab6a-3ffe1ccc8e90",
    "code": "VARIABLE_VALUE"
    },
    "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"businessId\" of required type \"ID!\" was not provided.",
    "locations": [
    {
    "line": 1,
    "column": 10
    }
    ]
    },
    {
    "extensions": {
    "id": "0b6bf2d3-25ca-48f6-8d46-306f7febf9af",
    "code": "VARIABLE_VALUE"
    },
    "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"id\" is not defined by type \"MoneyTransactionCreateInput\".",
    "locations": [
    {
    "line": 1,
    "column": 10
    }
    ]
    }
    ]
    }

  • PabblyPabbly Member Posts: 7

    Still not able to make it work

    { "errors": [ { "extensions": { "id": "bc5dc918-dd26-4a3e-ab6a-3ffe1ccc8e90", "code": "VARIABLE_VALUE" }, "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"businessId\" of required type \"ID!\" was not provided.", "locations": [ { "line": 1, "column": 10 } ] }, { "extensions": { "id": "0b6bf2d3-25ca-48f6-8d46-306f7febf9af", "code": "VARIABLE_VALUE" }, "message": "Variable \"$input\" got invalid value { id: \"QnVzaW5lc3M6NmQ3ZDE0MWUtNzg3NS00NjZiLThhMzQtNDY4YzA2NzZjNmQ3\", externalId: \"22222\", date: \"2020-11-29\", description: \"my money\", anchor: { accountId: \"1\", amount: \"15.00\", direction: \"DEPOSIT\" }, lineItems: [[Object]] }; Field \"id\" is not defined by type \"MoneyTransactionCreateInput\".", "locations": [ { "line": 1, "column": 10 } ] } ] }

Sign In or Register to comment.