From b43ffc4c929a1c085582033c49a79a7ce19d88fc Mon Sep 17 00:00:00 2001 From: Hillel Coren Date: Mon, 13 Mar 2017 21:09:22 +0200 Subject: [PATCH] Working on docs --- docs/api.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/docs/api.rst b/docs/api.rst index f54a12795529..138ca2fd0caa 100644 --- a/docs/api.rst +++ b/docs/api.rst @@ -14,8 +14,6 @@ Reading Data Here’s an example of reading the list of clients using cURL from the command line. -.. code-block:: shell - curl -X GET ninja.dev/api/v1/clients -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest" For invoices, quotes, tasks and payments simply change the object type. ie, @@ -24,22 +22,22 @@ For invoices, quotes, tasks and payments simply change the object type. ie, To load a single record specify the Id in the URL. Note: you can add ?invoice_number=0001 to search invoices by invoice number. -``curl -X GET ninja.dev/api/v1/invoices/1 -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest"`` + curl -X GET ninja.dev/api/v1/invoices/1 -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest" You can download a PDF using the following URL -``curl -X GET ninja.dev/api/v1/download/1 -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest"`` + curl -X GET ninja.dev/api/v1/download/1 -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest" Creating Data """"""""""""" Here’s an example of creating a client. Note that email address is a property of the client’s contact not the client itself. -``curl -X POST ninja.dev/api/v1/clients -H "Content-Type:application/json" -d '{"name":"Client","contact":{"email":"test@gmail.com"}}' -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest"`` + curl -X POST ninja.dev/api/v1/clients -H "Content-Type:application/json" -d '{"name":"Client","contact":{"email":"test@gmail.com"}}' -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest" You can also update a client by specifying a value for ‘id’. Next, here’s an example of creating an invoice. -``curl -X POST ninja.dev/api/v1/invoices -H "Content-Type:application/json" -d '{"client_id":"1", "invoice_items":[{"product_key": "ITEM", "notes":"Test", "cost":10, "qty":1}]}' -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest"`` + curl -X POST ninja.dev/api/v1/invoices -H "Content-Type:application/json" -d '{"client_id":"1", "invoice_items":[{"product_key": "ITEM", "notes":"Test", "cost":10, "qty":1}]}' -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest" If the product_key is set and matches an existing record the product fields will be auto-populated. If the email field is set then we’ll search for a matching client. If no matches are found a new client will be created. To email the invoice set email_invoice to true. @@ -50,7 +48,7 @@ Emailing Invoices To email an invoice use the email_invoice command passing the id of the invoice. -``curl -X POST ninja.dev/api/v1/email_invoice -H "Content-Type:application/json" -d '{"id":1}' -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest"`` + curl -X POST ninja.dev/api/v1/email_invoice -H "Content-Type:application/json" -d '{"id":1}' -H "X-Ninja-Token: TOKEN" -H "X-Requested-With: XMLHttpRequest" Optional Settings """""""""""""""""