Submit a request

Getting Started with the SOAP XML Web Service API




  • Avatar
    Chris Niemann

    Thanks for the Article! I found some useful info for my project, but I didn't find anything for my main problem.

    I need to Import/Save a completely new Item into the AC DB. I have to assume that there is no other items in the DB, so I cannot Product_GetByName() and change this product, and then upload it. Instead I think I have to create a completely new item. (PLEASE correct me here if I am wrong) 

    Essentially I have been working on this for a while and I am not sure how to go from here. I have created essentially a hardcoded copy of an item from the DB with minimum information ("Quick add item" Screen, and only filled in the fields marked with " * "). I could include how i created the item here but i feel like that would be a waste of 300 lines... Anyway i was able to just Product_Save(item) for the downloaded item ( item = Product_GetByName()), when i changed "IsNew = true", however i can not do this with the hardcoded item. 

    So i want to asking for something like a tutorial, detailed documentation, or a full example on how to create an item from scratch and then save this item. I think once i have a full item i will be able to save it like i have been, but i cant figure out what a full item needs. 


    Hope Someone can help me.


  • Avatar
    AmeriCommerce Developer



    I replied to your ticket about this also, but wanted to post here as well to hopefully give some guidance to others who might be using the API as well.


    I believe you are encountering these issues because you are specifying an itemID when trying to add the product. You shouldn't need to manually specify an itemID, that is handled automatically by the database. Nor should you need to specify "IsNew = true"; it should automatically create the product if it doesn't have an item ID.

    Here's a super simple example that I tested with to add a product (and a category) via the API:

    AmeriCommerceDatabaseIO oWs = new AmeriCommerceDatabaseIO();

    oWs.Url = "";

    AmeriCommerceHeaderInfo oHeader = new AmeriCommerceHeaderInfo();

    oHeader.UserName = "username";

    oHeader.Password = "password";

    oHeader.SecurityToken = "token";

    oWs.AmeriCommerceHeaderInfoValue = oHeader;

    // add a root level category

    CategoryTrans oCat = new CategoryTrans();

    oCat.catName = "Test Category";

    oCat.belongsTo = new DataInt32();

    oCat.belongsTo.Value = 0;

    oCat = oWs.Category_SaveAndGet(oCat);

    // add a product into the new category

    ProductTrans oProd = new ProductTrans();

    oProd.itemName = "API Test Product 1";

    oProd.itemNr = "APITP1";

    oProd.price = new DataMoney();

    oProd.price.Value = 5.00m;

    oProd.catID = oCat.catID;

    oProd.productStatusID = new DataInt32();

    oProd.productStatusID.Value = 1;

    oProd = oWs.Product_SaveAndGet(oProd);

    Also, you may realize this, but calling Product_Save(oProd) will return a bool; if you wanted to get back a usable object that had the ID populated after having been posted to the database, you could use oProd = Product_SaveAndGet(oProd)

  • Avatar
    Chris Niemann


    Along these line... what if i want to add an item to an maybe existing category (i am not sure if it exists). I know that if i use Category_SaveAndGet then it will just create a new category, but this is definetly not what i want. I know i can use Category_GetByName, but that throws a soapException if the cat does not exist, and i would rather not catch exception... is there something that returns a boolean ?

    I saw Category_Exists, but its unclear how to use this, since it takes picatID as a parameter, but i dont have that without getting that category first from the AC DB.


    Any help would be appreciated. 

  • Avatar
    Chris Niemann

    Me again, 

    how do you add multiple categories to a single item ?

    I know that by using a csv upload file it would look like this: Jerseys|Jerseys > Kids Jerseys|Kids|Kids > Childrens but using otherCategories on the ProductTrans doesnt work, and carID is not an array...

  • Avatar
    Diganta Kumar Das

    What is Security Token here? Can any one please expain ? my store front is and I want to retrieve user purchase details with the help of api.

Please sign in to leave a comment.