Reply
kennethprose
New Member
Partially syndicated - Outbound

Data from API

Hi everyone. 

I'm having big problems retreving some data from an restfull api. 

APi documentation example looks like this. 


Product

Usage

This endpoints allows retrieveal, creation, modification and deletion of products in Warehouze, it also allows retrieval of stock quantities pr. warehouse.

Get

Call requires at least one property name, blank query is allowed.

 

Product Properties
Name Type Description Updatable
AdjustedInStockQtyDecimal False
BarcodeString True
BarredBoolean True
BaseNumberString False
ColliQtyDecimal False
CompanyIdInt32 False
CreationDateDateTime False
CustomProductPropertyFiveString False
CustomProductPropertyFourString False
CustomProductPropertyOneString False
CustomProductPropertyThreeString False
CustomProductPropertyTwoString False
DataSourceDataSource0 Economic, 1 SmartWeb, 2 Local, 3 Magento, 4 GoldenPlanet, 5 Shopify, 6 WooCommerce, 7 FakturaFil, 8 IEXFalse
DeliveryDaysInt32 True
ExtraCostsDecimal False
GroupIdInt32 False
HeightDecimal False
IdInt32 False
IncludeInShoppinglistBoolean False
IsCollectionMasterBoolean False
IsMasterBoolean False
LastUpdatedDateTime False
LengthDecimal False
LocationIdInt32 False
NameString True
NotesString True
NotificationsString False
NumberString False
OrderedByCustomersQtyDecimal False
OrderedFromSuppliersQtyDecimal False
PoQtyMinDecimal False
SelectedVariantType1String False
SelectedVariantType2String False
ShippingMethodString False
ShippingPriceDecimal False
ShoppingQtyDecimal False
StockQtyDecimal False
SupplierIdInt32 True
SupplierProductNumberString True
TurnoverQtyDecimal False
UnitCostPriceDecimal False
UnitIdInt32 False
UnitPriceDecimal False
UnitSalesPriceDecimal False
VariantMasterIdInt32 False
VolumeDecimal False
WarehouseIdInt32 False
WeightDecimal False
WidthDecimal False
 
Sample Get call
        var request = {
            Token: "Insert your token here",
            Query: [
                              "Number=130",
                              "WarehouseNumber=1",
            ],
            Properties: [
                            "Id",
                            "Name",
                            "StockQty",
            ],
        };
        $.ajax({
            url: "https://api.warehouze.io/Product",
            data: request,
            dataType: 'text',
            type: "GET",
            traditional: true,
            success: function (data) {
                console.log(data);
            },
            error: function (data, xHr) {
                console.log(data);
                console.log(xHr);
            }
        });
            

Can anyone help me how to extract data?

1 REPLY 1
lbendlin
Super User
Super User

Syndicated - Outbound

You can't have a GET request with a payload in Power BI (or anywhere, I think).  It has to be a POST request.

 

Power BI does all that automatically via Web.Contents and Json.FromValue 

 

for example:

 

let
URL = "http://xxx/tstat",

headers = [#"Content-Type"="application/json"],
data = Json.FromValue([tmode = 2,t_cool = Setpoint,hold = 0]),
web = Web.Contents(URL, [ Content = data, Headers = headers, ManualStatusHandling = {404, 400}]),
result = Json.Document(web)

in result

avatar user

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

FebPBI_Carousel

Power BI Monthly Update - February 2025

Check out the February 2025 Power BI update to learn about new features.

Feb2025 NL Carousel

Fabric Community Update - February 2025

Find out what's new and trending in the Fabric community.

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)