Please refer to the API documentation section for the most up-to-date information
https://developer.finaleinventory.com/reference/start
--
The following example shows connecting to Finale Inventory using the curl tool, retrieving the list of products, creating a new product, and then modifing a product.
To try this example on your own account you will need to replace the "newcentury" account name in the URL with your account name, and use your own username and password to authenticate.
Start by authenticating with Finale Inventory, storing the cookie response header in a temporary file
curl https://app.finaleinventory.com/newcentury/api/auth -c /tmp/cookie
-d '{"username":"test","password":"test"}'
Finale responds with:
{ "name" : "test",
"resourceFacilityUrl" : "/newcentury/api/facility/",
"resourceHazardousMaterialUrl" : "/newcentury/api/hazardousmaterial/",
"resourceInventoryItem" : "/newcentury/api/inventoryitem/",
"resourceInventoryTransfer" : "/newcentury/api/inventorytransfer/",
"resourceInventoryVariance" : "/newcentury/api/inventoryvariance/",
"resourceInventoryVarianceSummary" : "/newcentury/api/inventoryvariancesummary/",
"resourceOrder" : "/newcentury/api/order/",
"resourceOrderSummary" : "/newcentury/api/ordersummary/",
"resourcePartyGroup" : "/newcentury/api/partygroup/",
"resourceProduct" : "/newcentury/api/product/",
"resourceShipment" : "/newcentury/api/shipment/"
}
After this request, the cookie file contains the JSESSIONID required to make further requests:
# Netscape HTTP Cookie File
# http://curlm.haxx.se/rfc/cookie_spec.html
# This file was generated by libcurl! Edit at your own risk.
app.finaleinventory.com FALSE / FALSE 0 JSESSIONID 7iv03w5zpgm0.node1
Retrieve the list of all products, including the session cookie in our request for authentication:
curl https://app.finaleinventory.com/newcentury/api/product/ -b /tmp/cookie
Finale responds with the product representation stored in a column major table:
{ "productId" : ["NCP-001","NCP-018"],
"internalName" : ["Red Comet","Blue mine"],
"statusId" : ["PRODUCT_ACTIVE","PRODUCT_ACTIVE"],
"productUrl" : ["/dev/api/product/NCP-001","/dev/api/product/NCP-018"],
"actionUrlDeactivate" : ["/dev/api/product/NCP-001/deactivate","/dev/api/product/NCP-018/deactivate"],
"manufacturerName" : ["Lidu","RES"]
}
Create a product by posting to the resource collection, including the session cookie both in the request header and in the POST body:
curl https://app.finaleinventory.com/newcentury/api/product/ -b /tmp/cookie
-d '{"productId":"NCP-002","internalName":"Green peony","sessionSecret":"20giiasvfbb5.node1"}'
Finale responds with the representation of new product, including additional fields added by the server:
{ "productId" : "NCP-002",
"internalName" : "Green peony",
"statusId" : "PRODUCT_ACTIVE",
"productUrl" : "/dev/api/product/NCP-002",
"actionUrlDeactivate" : "/dev/api/product/NCP-002/deactivate"
}
Modify the product we just created by posting to its productUrl (any fields not included in the post are left unchanged):
curl https://app.finaleinventory.com/newcentury/api/product/NCP-002 -b /tmp/cookie
-d '{"internalName":"Green peony to crackle","sessionSecret":"20giiasvfbb5.node1"}'
Finale responds with the representation of the modified product:
{ "productId" : "NCP-002",
"internalName" : "Green peony to crackle",
"statusId" : "PRODUCT_ACTIVE",
"productUrl" : "/dev/api/product/NCP-002",
"actionUrlDeactivate" : "/dev/api/product/NCP-002/deactivate"
}
Take an action to deactivate the product using an actionUrl specified by the server:
curl https://app.finaleinventory.com/newcentury/api/product/NCP-002/deactivate -b /tmp/cookie
-d '{"sessionSecret":"20giiasvfbb5.node1"}'
Finale responds with the representation of the product after the action. In this case the statusID updates, the actionUrlDeactivate is removed since it is not a valid operation in the product's current state, and the actionUrlActivate is added as it is now valid:
{ "productId" : "NCP-002",
"internalName" : "Green peony to crackle",
"statusId" : "PRODUCT_INACTIVE",
"productUrl" : "/dev/api/product/NCP-002",
"actionUrlActivate" : "/dev/api/product/NCP-002/activate"
}
Comments
0 comments
Article is closed for comments.