Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

api.runWithBudget is not a function #52

Closed
7aklhz opened this issue Sep 21, 2022 · 16 comments
Closed

api.runWithBudget is not a function #52

7aklhz opened this issue Sep 21, 2022 · 16 comments
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@7aklhz
Copy link

7aklhz commented Sep 21, 2022

I'm trying to get the API to work. Here is what I've done
1- I've installed actual-server locally and it's running on port 5006
2- I cd into the folder and installed the api using yarn add @actual-app/api
3- I created a test.js file in the actual-server folder and copy paste the following code
let api = require('@actual-app/api'); async function run() { let budget = await api.getBudgetMonth('2019-10'); console.log(budget); } api.runWithBudget('My-Budget', run);
4- I updated "My-Budget" with my id
5- I run using node test.js and get the following error

TypeError: api.runWithBudget is not a function

Can you please advise ?

@manuelseeger
Copy link

runWithBudget doesn't exist anymore. The API docs are now here: https://github.com/actualbudget/actual/blob/master/docs/API.md

Additional hint: you'll need the technical uuid for load-budget.

@7aklhz
Copy link
Author

7aklhz commented Sep 22, 2022

Well that explains a lot ! I did realize by looking at the functions that it was missing but this is now clearer

What is "technical uuid" ?

Also, can you give me an example of init config ? I'm having this for the moment

await actual.init({
        config: {
            dataDir: { config: { dataDir: '/documents/Actual' } }
        }
    });

But it's not working

@7aklhz
Copy link
Author

7aklhz commented Sep 22, 2022

Ok, i got it to work. Thanks

@amthna
Copy link

amthna commented Oct 18, 2022

@7aklhz would you mind sharing how you got this running? I'm having issues myself.

@rich-howell rich-howell transferred this issue from actualbudget/actual-server Oct 28, 2022
@rich-howell
Copy link
Contributor

Moved this to documentation to build out some more examples around this as the issue itself isn't actually an issue but rather a call for advice.

@rich-howell rich-howell added documentation Improvements or additions to documentation help wanted Extra attention is needed labels Oct 29, 2022
@JamesHenry
Copy link

JamesHenry commented Jan 14, 2023

@rich-howell I'm confused as to why this isn't an issue? I ended up here because the documentation website gives out of date instructions, that's an issue with the docs, right?

The docs currently tell you to use runWithBudget which doesn't exist:

https://github.com/actualbudget/docs/blob/master/docs/Developers/using-the-API.md

This comment #52 (comment) above does not seem to be applicable anymore either:

Because https://github.com/actualbudget/actual/blob/master/docs/API.md does not exist.

Are there any up to date docs for how to use the API please?

@j-f1
Copy link
Contributor

j-f1 commented Jan 14, 2023

Here’s the docs from when that comment was posted: https://github.com/actualbudget/actual/blob/HEAD@%7B2022-09-22T12:05:27Z%7D/docs/API.md

@JamesHenry
Copy link

Thanks @j-f1, do you have any idea how to figure out the value to give to dataDir? I am just running the actual-server repo locally...

This is my first time getting reacquainted with the project since the switch to OSS

@j-f1
Copy link
Contributor

j-f1 commented Jan 14, 2023

Working on updating the docs, it’s a bit complicated and I think the API package needs some improvements to make things easier.

@j-f1
Copy link
Contributor

j-f1 commented Jan 14, 2023

The dataDir should be the user-files dir of the server.

@JamesHenry
Copy link

@j-f1 that is what I had guessed but it doesn't seem to work...

Again this is a fresh installation, I have not done anything custom AFAIK

image

image

@j-f1
Copy link
Contributor

j-f1 commented Jan 14, 2023

Try the Sync ID instead.

@JamesHenry
Copy link

@j-f1 sadly not! Hopefully you or one of the other maintainers wouldn't mind trying to repro with a fresh copy of actual-server some time next week

@j-f1
Copy link
Contributor

j-f1 commented Feb 27, 2023

Try again with v5 of the API package and let me know if you still have issues :)

@JamesHenry
Copy link

Thanks so much @j-f1, sorry for the delay. I will set aside some time this weekend to try this out and let you know!

@MatissJanis
Copy link
Member

This should be fixed. Closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants