I have a quick question… I want to install the PHP API onto my selfhost installation on Invoice Ninja. On GitHub I see the following line in the setup:
NinjaConfig::setURL(‘https://ninja.dev/api/v1’);
What url do I have to put there? Is replacing ninja.dev with my own domain (where I installed Invoice Ninja) good enough?
Also, is there a detailed documentation about the API?
Yes I was talking about the PHP SDK. Which URL do I need to put there?
I’ve tested the URL of my Invoice Ninja installation with the following cURL request: curl -X GET ninja.test/api/v1/clients -H “X-Ninja-Token: TOKEN”
The TOKEN I filled in was an API token created in my Invoice Ninja installation. I’ve tried multiple URL’s but none worked. Just replacing ‘ninja.test’ with my domain (and then adding /api/v1/clients) results in a 400 bad request error.
I’m sorry if I’m not so clear haha, not a native English speaker
The code from my previous message was to get clients via cURL. That code was precisely the code that was in the API documentation. I’ve tested that code on http://onlinecurl.com/. I’ve only changed the token and the url. The only thing I get is a http 400 bad request error.
This is my cURL code (without valid token): curl -X GET congreatspay.eu/api/v1/clients -H “X-Ninja-Token: VALIDTOKEN”
/clients needs to be there for the right command right. I think /api/v1 doesn’t work on my self hosted version or something. Or that part of the url needs to be something else. If you want to test it I could send a test key via email.
Am I doing something wrong? Hopefully you can help me.
I’ve just tested the command from my previous message on my Macbook. There I get a 404 error. /api/v1 is nothing on my Invoice Ninja installation. Do I need to use something else? Because the link you said in the message above is precisely the link I use, I only changed ‘domain.com’ to my real domain.
Wait… Do I have to install the SDK on the Invoice Ninja server? I thought the SDK was there to make a connection between a project and my Invoice Ninja server. I’ve not yet installed the PHP SDK into a project.
I first wanted to try the connection. So I just picked the first cURL API command from the API documentation, edited the data and ran the command. But until now that only results in a 400 and 404 error. Do I need to install something before I can use the API?