Browse Documentation
POST Add item picture

Add Item Picture

POST /items/:item_id/images

Parameters

ParameterTypeDescription
url or encoded_stringStringThis is the url of the image to be uploaded or otherwise provide the base64_encoded_string of the image
item_idStringThis is the hash value of the item you want to a picture to.
filenameStringThis is the name of the picture file.


A POST request is expected to be sent to the above endpoint where the content body must be JSON string containing all parameters that are needed to add a picture to an item. The below example demonstrates how to add picture to the item.


REQUEST

1. UPLOAD IMAGES WITH BASE64 ENCODED STRING[You must provide Filename]

    
 
curl - s - H "Content-Type: application/json" - H "Authorization: Bearer token"\ -
XPOST\ -

d '{
   "image": {
      "encoded_string": "paste image base64 code here",
      "filename": "sample.jpg"
   }
}

2. UPLOAD IMAGES WITH URL[Filename is not necessary]

    
 
curl - s - H "Content-Type: application/json" - H "Authorization: Bearer token"\ -
XPOST\ -

d '{
   "image": {
      "url": "https://f.accounteer.com/sample1.png"
   }
}' \
https://app.accounteer.com/api/v0.1/item/{item_id}/images

Example Request:
https://app.accounteer.com/api/v0.1/item/ea5aa6f73fcb434ac9172cd6ca6b3ab560da51ee/images

      


RESPONSE

    
{  
      "id":"ea5aa6f73fcb434ac9172cd6ca6b3ab560da51ee",
      "organization_id":"63563de311606b6528fdf949b7c9128afba414d3",
      "title":"item name",
      "description":"item description",
      "sales_price":"120.00",
      "purchase_price":"100.00",
      "show_invoices":true,
      "show_purchases":true,
      "tax":null,
      "gl_account_sales":{  
         "id":"cd48f5ccfd5069c7e5f066404c0e372bec1ccca1",
         "code":"4000",
         "title":"Sales",
         "description":null
      },
      "gl_account_purchases":{  
         "id":"10a2d9acddf01204756487a6775e3db1a37f1f92",
         "code":"6000",
         "title":"Productive labor",
         "description":null
      },
      "item_category":null,
      "images":[  
         {  
            "id":"f53fa136c53657367d73add5788faf818483fc28",
            "file_url":"https://f.accounteer.com/f53fa136c53657367d73add5788faf818483fc28/63563de311606b6528fdf949b7c9128afba414d3/test.png",
            "file_name":"test.png",
            "date_created":"2018-02-22"
         },
         {  
            "id":"16df7928c8c04f1e0442dc2c7931d9fed7e17bf7",
            "file_url":"https://f.accounteer.com/16df7928c8c04f1e0442dc2c7931d9fed7e17bf7/63563de311606b6528fdf949b7c9128afba414d3/test.png",
            "file_name":"test.png",
            "date_created":"2018-02-22"
         }
      ],
      "date_created":"2018-01-04",
      "date_updated":"2018-01-04"
   }

The API will return a 201 status including the complete item object to which the image was uploaded.