order xml download

Hello,

For now i can not find an option to download an particularly order.
is this not possible without using the api ?
if not is it an idea to add an option to the more action button for an xml file download ?

it would be very convenient for me !

kind regards
peter

Comments

  • 9 Comments sorted by Votes Date Added
  • yes I know, but it does not download the items which are present in each order.
    I dont need the know the order details but only the items in an order downloadable as an xml file :)

    I did not say that very clearly....
  • Hi Peter,

    You can use the API:

    Items

    GET https://api.brickowl.com/v1/order/items
    Retrieve order items

    Arguments

    order_id - The orders unique ID

    This requires some programming. In C# you can download this result and use the function SaveToXML.

    Frank
  • Hi,

    thanks for your answer, I placed it in the suggestion section because it would be handy to have this function. but programming something like this is also not a problem :)

    I understand what you are saying but how can I connect to the database with C#?

    greetings
    peter
  • Hi,

    I tried to achieve something similar when I designed my custom BrickOwl Integration App, you can take a look at a code sample here: https://dotnetfiddle.net/w6WTGP

    Feel free to reuse & modify my code. This will allow you to get order details.

    You can use other API calls (i.e. the one mentioned by Frank) to retrieve order items for a given order. I don't have a sample for that, but you can figure this out yourself :)

    All you need is a NewtonSoft JSON library installed and your own BrickOwl API key.

    I hope it helps, at least it will give you an overview on how to use BO API through C#.
    You may need to modify my code and add some extra stuff if you're looking for different functionality.

    Regards
    Monika
  • Hi Peter,

    It's like Monika shows in her example. You get the results from the BO-website. This result is in JSON.

    Here is my code to save the result into XML:

    private void getUrl(string uri, string parameters, string fileName)
    {
    string myStringWebResource = null;
    string result = null;
    // Create a new WebClient instance.
    WebClient webClient = new WebClient();
    // Concatenate the domain with the Web resource filename.
    myStringWebResource = uri + "?" + parameters;
    Console.WriteLine("Downloading File \"{0}\" from \"{1}\" .......\n\n", fileName, myStringWebResource);
    // Download the Web resource and save it into the current filesystem folder.

    result = webClient.DownloadString(myStringWebResource);

    // To convert JSON text contained in string json into an XML doc
    XmlDocument doc = (XmlDocument)JsonConvert.DeserializeXmlNode( "{\"inventory\":" + result + "}", "bo_inventory");
    doc.Save(fileName);

    Console.WriteLine("Successfully Downloaded File \"{0}\" from \"{1}\"", fileName, myStringWebResource);
    Console.WriteLine("\nDownloaded file saved in the following file system folder:\n\t" + Application.StartupPath);
    }

    Just declare a JSON and XML parser.

    Succes.
    Frank
  • many thanks, I'm going to work on this !
  • Another way you could do this without coding is to upload the JSON file to json-csv.com - then open the CSV file in a spreadsheet and search for the order.
This discussion has been closed.