Making a new invoice from Api2

I’m seeking expertise in accessing inventory data using item codes to determine available quantities and proficiency in using API2 to generate new sales invoices.

My goal is to integrate a point-of-sale (POS) system with a manager to automate the creation of invoices based on daily sales transactions.

If you have any knowledge, guidance, or assistance to offer, I would greatly appreciate your support in achieving this integration.

1 Like

facing the same issue here

when creating an invoice you must add the items with the β€œkey” not with their item code, and to get the key there is another request yo have to make

im trying to create it with the item code but no luck, which as a workaround i have to make a DB to match both item codes and manager item key

here is an example on how to get the inventory items key with all the parameters (item code, etc…):

METHOD:GET

http://localhost:55667/api2/inventory-items?fields=Image&fields=ItemCode&fields=ItemName&fields=ControlAccount&fields=Division&fields=Description&fields=SalePrice&fields=PurchasePrice&fields=UnitName&fields=QtyOnHand&fields=QtyToDeliver&fields=QtyAvailable&fields=QtyToReceive&fields=QtyToBeAvailable&fields=QtyDesired&fields=QtyToOrder&fields=Obsolete_QtyToReceive&fields=Obsolete_QtyOnHand&fields=Obsolete_QtyToDeliver&fields=QtyOwned&fields=AverageCost&fields=TotalCost&fields=Timestamp

put this in postman and delete unnecessary ones

to create an invoice with multi items:

use this

POST

http://localhost:55667/api2/sales-invoice-form

JSON DATA:

{
    "image": null,
    "attachment": "False",
    "edit": null,
    "view": null,
    "issueDate": "2024-04-1",
    "reference": null,
    "customer": null,
    "description": null,
    "invoiceAmount": {
        "value": 1000.00,
        "currency": null
    },
    "balanceDue": {
        "value": 0.0,
        "currency": null
    },
    "status": "PaidInFull",
    "Lines": [
        {
            "Item": "324db506-6cd8-4c7d-8736-c446e2de5982",
            "Qty": 99.0,
            "SalesUnitPrice": 10.0
        },
        {
            "Item": "324db506-6cd8-4c7d-8736-c446e2de5982",
            "Qty":1 ,
            "SalesUnitPrice":9
            },
            {"Item": "0f8b8a4f-da5e-446e-83a4-386ec743287c",
            "Qty":12 ,
            "SalesUnitPrice":    8     }
    ]
}

use api v1 to get more accurate examples for your entity

We can get Inventoy Items data with the term

http ://127.0.0.1:55667/api2/inventory-items?term=MyItemCode

For the json structure, we can get it from Api1, or from BatchUpdate column and compile it into json.

Just tried it, the term cannot be used to search for ItemCode. It looks like we have to take all Inventory item data and create a dictionary of ItemCode, ItemName

It should work for any column but you need to specify which columns you want to retrieve. Then term parameter will search across those columns only.

Previously I thought so

My Items

{
  "business": {
    "name": "Mailjet_Themes"
  },
  "skip": 0,
  "pageSize": 50,
  "totalRecords": 5,
  "inventoryItems": [
    {
      "key": "83e8f32b-b465-4f3b-8607-97fc330e6256",
      "itemCode": null,
      "itemName": "Item 1"
    },
    {
      "key": "6368bd2a-2ff1-4d5b-aa34-97554f4cabda",
      "itemCode": "ITM-00",
      "itemName": "Item Vat 0%"
    },
    {
      "key": "fcfa1eb0-4d6e-4961-9b64-e1e045ad836c",
      "itemCode": "ITM-09",
      "itemName": "Item Vat 9%"
    },
    {
      "key": "150d36d1-4be6-445b-baaa-e03fdffa2092",
      "itemCode": "ITM-15",
      "itemName": "Item Vat 15%"
    },
    {
      "key": "e739607c-2813-4738-8bd0-487e3fdb7e00",
      "itemCode": "ITM-Exm",
      "itemName": "Item Exempt"
    }
  ]
}

FetchData

https://{subdomain}.manager.io/api2/inventory-items?term=ITM-15&fields=ItemCode&fields=ItemName

Result

{
  "business": {
    "name": "Mailjet_Themes"
  },
  "skip": 0,
  "pageSize": 50,
  "totalRecords": 0,
  "inventoryItems": []
}

I would like to extend my sincere gratitude to each and every one of you. Your contributions and support have been invaluable, and I am truly grateful for your assistance.

Thank you,

2 Likes