Skip to content

Instantly share code, notes, and snippets.

@carcamano
Last active October 19, 2023 11:39
Show Gist options
  • Save carcamano/9a0e980d83be2a444c4463d53432992f to your computer and use it in GitHub Desktop.
Save carcamano/9a0e980d83be2a444c4463d53432992f to your computer and use it in GitHub Desktop.
Sample of SmartComex Open Data Request on Power BI
let
Source = Json.Document(
Web.Contents(
"https://api.smartcomex.io/open-data",
[
Headers = [
#"Authorization"="Basic OHRqYUpCUDE3eGpBTmF4NFBBQ0N6QmpGNlhRYXNYaEk6bVRpZnNGaHJPUk1aTkh2RkkxdXRpMVhzOHVWZTQ4Mmw=",
#"Content-Type" = "application/json"
],
Content=Text.ToBinary("{
""entity"":""quotation"",
""pagination"": {
""limit"": 100
},
""conditions"": [
{
""column"": ""stPricing"",
""value"": [""OPERATION"", ""APPROVED""],
""operator"": ""in""
}
]
}")
]
)
),
#"Converted to Table" = Table.FromList(Source, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column" = Table.ExpandRecordColumn(#"Converted to Table", "Column1",
{"cdPricing","cdQuotation","tpOperation","tpModality","cdProcess","cdCountry","dtQuotationCreated","dtExpire","dtQuotation","dtPricing","stQuotation","stPricing","dsYear","dsMonth","dsQuotationYear","dsQuotationMonth","tpPPCCPricing","tpPPCCQuotation","nmCustomerQuot","nmCustomerContactQuot","nmCustomer","nmSalesman","nmSalesman2","dsRoutingOrder","nmCneeMasterProc","nmCneeHouseProc","nmCneeMaster","nmCneeHouse","nmShipperMasterProc","nmShipperHouseProc","nmShipperMaster","nmShipperHouse","cdCountryOrig","cdPortOrig","nmPortOrig","cdCountryDest","cdPortDest","nmPortDest","cdCurrency","vlProfit","vlProfitHouse","cdFreightTypeMaster","cdFreightTypeHouse","nmAgentPayProc","nmAgentPayOffice","nmAgent","nmAgentCompany","nmCarrier","nmColoaderProc","nmColoader","dsProject","nmUserOperation","nmUserPricing","vlCubic","vlWeight","vlWeightBilled","nmUserCreatedQuotation","nmOffice","nmCompany","dtApproval","nmNetworking","nmIndication","tpLossReason","nmSubStatus","currentCheckListName","currentCheckListCheck","currentCheckListObs","dtCurrentCheckList","dtCurrentCheckListNotify","dtCurrentCheckListStart","nextCheckListName","nextCheckListCheck","nextCheckListObs","dtNextCheckList","dtNextCheckListNotify","dtNextCheckListStart","dsCntrCodes","dsVolumes","nbCountVolumes","nbSumQtVolumes","nbTeus","nbQtCntr","vlTotalDebitsOffice","vlTotalCreditsOffice","vlTotalBuyFreightOffice","vlTotalSellFreightOffice","vlTotalBuyHandlingOffice","vlTotalSellHandlingOffice","vlTotalBuyTHCOffice","vlTotalSellTHCOffice","vlTotalBuyProfitAgentOffice","vlTotalSellProfitAgentOffice","vlTotalBuyDemurrageOffice","vlTotalSellDemurrageOffice","dtFile","dtCreated","dtUpdated"},
{"cdPricing","cdQuotation","tpOperation","tpModality","cdProcess","cdCountry","dtQuotationCreated","dtExpire","dtQuotation","dtPricing","stQuotation","stPricing","dsYear","dsMonth","dsQuotationYear","dsQuotationMonth","tpPPCCPricing","tpPPCCQuotation","nmCustomerQuot","nmCustomerContactQuot","nmCustomer","nmSalesman","nmSalesman2","dsRoutingOrder","nmCneeMasterProc","nmCneeHouseProc","nmCneeMaster","nmCneeHouse","nmShipperMasterProc","nmShipperHouseProc","nmShipperMaster","nmShipperHouse","cdCountryOrig","cdPortOrig","nmPortOrig","cdCountryDest","cdPortDest","nmPortDest","cdCurrency","vlProfit","vlProfitHouse","cdFreightTypeMaster","cdFreightTypeHouse","nmAgentPayProc","nmAgentPayOffice","nmAgent","nmAgentCompany","nmCarrier","nmColoaderProc","nmColoader","dsProject","nmUserOperation","nmUserPricing","vlCubic","vlWeight","vlWeightBilled","nmUserCreatedQuotation","nmOffice","nmCompany","dtApproval","nmNetworking","nmIndication","tpLossReason","nmSubStatus","currentCheckListName","currentCheckListCheck","currentCheckListObs","dtCurrentCheckList","dtCurrentCheckListNotify","dtCurrentCheckListStart","nextCheckListName","nextCheckListCheck","nextCheckListObs","dtNextCheckList","dtNextCheckListNotify","dtNextCheckListStart","dsCntrCodes","dsVolumes","nbCountVolumes","nbSumQtVolumes","nbTeus","nbQtCntr","vlTotalDebitsOffice","vlTotalCreditsOffice","vlTotalBuyFreightOffice","vlTotalSellFreightOffice","vlTotalBuyHandlingOffice","vlTotalSellHandlingOffice","vlTotalBuyTHCOffice","vlTotalSellTHCOffice","vlTotalBuyProfitAgentOffice","vlTotalSellProfitAgentOffice","vlTotalBuyDemurrageOffice","vlTotalSellDemurrageOffice","dtFile","dtCreated","dtUpdated"}
)
in
#"Expanded Column"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment