Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
kennethprose
New Member

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

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors