Download

[Feature Request] Marketplace API

Hey,

I’m currently developing my website, and it would be awesome if the marketplace could have an API to easily get product data.

On one of my web pages, I display a “card” for each of my marketplace items with a link. At the moment, I do this by creating an XML file and manually filling in the fields, which the page can then use to semi-dynamically update the contents of that page.

Would be cool if I could just do a GET request and dynamically fill my page

For anybody that is curious how I currently display my Unreal products on my page.
I manually write this XML file:



<?xml version="1.0" encoding="UTF-8"?>
<products>
    <product>
        <title>Abandoned Bunker/Prison Props pack</title>
        <img_url>https://cdn1.epicgames.com/ue/product/Thumbnail/AbandonedBunkerPrisonPropspack_thumb-284x284-b3ab792c5bb3ca91656d9809920bd668.png</img_url>
        <description>Generic props for abandoned themed environments</description>
        <link_url>https://unrealengine.com/marketplace/en-US/slug/abandoned-bunker-prison-props-pack</link_url>
        <price>19.99</price>
    </product>

    <product>
        <title>Medieval/Fantasy Modular Wooden Catwalk</title>
        <img_url>https://cdn1.epicgames.com/ue/product/Thumbnail/MedievalFantasyModularWoodenCatwalk_thumb-284x284-1f4742ef177e85fd971e8af8abf9f571.png</img_url>
        <description>Medieval/Fantasy themed wooden catwalk modular kit</description>
        <link_url>https://unrealengine.com/marketplace/en-US/slug/medieval-fantasy-modular-wooden-catwalk</link_url>
        <price>19.99</price>
    </product>

    <product>
        <title>Sci-Fi Street Asset Pack</title>
        <img_url>https://cdn1.epicgames.com/ue/product/Thumbnail/SciFiStreetAssetPack_thumb-284x284-aa6839f70a0166abf0af5e1de39a7c0b.png</img_url>
        <description>Sci-Fi Street Props</description>
        <link_url>https://unrealengine.com/marketplace/en-US/slug/sci-fi-street-asset-pack</link_url>
        <price>19.99</price>
    </product>

    <product>
        <title>Underground Station Pack</title>
        <img_url>https://cdn1.epicgames.com/ue/product/Thumbnail/UndergroundStationPack_thumb-284x284-93cb88e5dc508a924da9848258ebff0a.png</img_url>
        <description>Underground station asset pack</description>
        <link_url>https://unrealengine.com/marketplace/en-US/slug/underground-station-pack</link_url>
        <price>19.99</price>
    </product>
</products>


Then on the page displaying my content I get the XML file and loop through the elements and display the elements:



$product_xml = simplexml_load_file("unreal_products.xml");

 foreach($product_xml->children() as $product)
 {
   echo "<section class='col-md-3 p-3'>";
     echo "<section class='card'>";

       echo "<img alt='Image of product' src='". $product->img_url ."' class='card-img-top'>";

       echo "<div class='card-body'>";

         echo "<h4 class='card-title pl-2 pr-2 pt-1 pb-1'>". $product->title . "</h4>";
         echo "<p class='card-text pl-2 pr-2 pt-1 pb-1'>". $product->description . "</p>";
         echo "<p class='pl-2 pr-2 pt-1 pb-1'><a class='btn btn-primary stretched-link ' href='". $product->link_url ."' target='_blank' >Download from Marketplace</a></p>";

        echo "</div>";

      echo "</section>";

    echo "</section>";
}


This works nicely. Now I just need a way to automatically fill the XML data instead of having to write it by hand.

I’m thinking it may be possible to crawl the individual product pages. On the actual product pages, the elements with the product details have nice, human readable class names related to what they contain.Firstly we would want a way to retrieve the urls for each of the products from you main seller page. You will probably be able to crawl the thumbnails from this page too. Then on the product page, we can retreive a few details.

Inside “asset-details”:
“image-gallery-image” Will give us the first image on the product page. This isn’t the thumbnail though, so not perfect.
“post-title” will give us the title
“asset-detail-text”. Product description. This is the full description though, so you might have to generate a short text from that.
“base-price” Will give us the price
“save-discount” will give us the discounted rate, if any
The og tags in the header is another source of details you can crawl

On the profile page, where your products are listed.
It looks like the assets are listed in a container named “clearfix” inside “asset-list-group”
Each product looks like it has its own container called “asset-container”
Inside the div with name “image-box” you will find both the thumbnail url, and the product page url
It also looks like you can use the images alt and title tags to get the product title. Looks like they just use that for the alt/title tags.
The price can be found under “asset-price”
The category can be found inside the anchor with the class “mock-ellipsis-item-cat” under “category-full-view”