)clear
clear ws
      )copy conga Conga
C:\apps\dyalog182U64\ws\conga.dws saved Tue Mar  8 14:28:06 2022
      i←Conga.Init ''
      ]load HttpCommand
#.HttpCommand
      service←'https://services.odata.org/V4/Northwind/Northwind.svc'
      ⎕←res←HttpCommand.Get service
[rc: 0 | msg:  | HTTP Status: 200 "OK" | ⍴Data: 2016]
      200↑res.Data
{"@odata.context":"https://services.odata.org/V4/Northwind/Northwind.svc/$metadata","value":[{"name":"Categories","kind":"EntitySet","url":"Categories"},{"name":"CustomerDemographics","kind":"EntitySe
      jres←⎕json res.Data
      jres.⎕nl -2 9
 value  ⍙⍙64⍙odata⍙46⍙context 
      jres.value
 #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON
       object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON o
      bject].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON object].[JSON object]  #.[JSON obj
      ect].[JSON object]  #.[JSON object].[JSON object] 
      jres.value[1].⎕nl -2 9
 kind  name  url 
      ⍪jres.value.(kind url)
  EntitySet  Categories                        
  EntitySet  CustomerDemographics              
  EntitySet  Customers                         
  EntitySet  Employees                         
  EntitySet  Order_Details                     
  EntitySet  Orders                            
  EntitySet  Products                          
  EntitySet  Regions                           
  EntitySet  Shippers                          
  EntitySet  Suppliers                         
  EntitySet  Territories                       
  EntitySet  Alphabetical_list_of_products     
  EntitySet  Category_Sales_for_1997           
  EntitySet  Current_Product_Lists             
  EntitySet  Customer_and_Suppliers_by_Cities  
  EntitySet  Invoices                          
  EntitySet  Order_Details_Extendeds           
  EntitySet  Order_Subtotals                   
  EntitySet  Orders_Qries                      
  EntitySet  Product_Sales_for_1997            
  EntitySet  Products_Above_Average_Prices     
  EntitySet  Products_by_Categories            
  EntitySet  Sales_by_Categories               
  EntitySet  Sales_Totals_by_Amounts           
  EntitySet  Summary_of_Sales_by_Quarters      
  EntitySet  Summary_of_Sales_by_Years         
      jres.⍙⍙64⍙odata⍙46⍙context
https://services.odata.org/V4/Northwind/Northwind.svc/$metadata
      ⍝ crtl+click on the link
      ObjIn←{(⊃⍵).⎕NL-2 9}
      ⎕←orders←HttpCommand.Get service,'/Orders'
[rc: 0 | msg:  | HTTP Status: 200 "OK" | ⍴Data: 70806]
      jorders←⎕json orders.Data
      ObjIn jorders
 value  ⍙⍙64⍙odata⍙46⍙context  ⍙⍙64⍙odata⍙46⍙nextLink 
      ObjIn jorders.value
 CustomerID  EmployeeID  Freight  OrderDate  OrderID  RequiredDate  ShipAddress  ShipCity  ShipCountry  ShipName  ShipPostalCode  ShipRegion  ShipVia  ShippedDate 
      ⍴jorders.value.ShippedDate
200
      10↑jorders.value.ShippedDate
 1996-07-16T00:00:00Z  1996-07-10T00:00:00Z  1996-07-12T00:00:00Z  1996-07-15T00:00:00Z  1996-07-11T00:00:00Z  1996-07-16T00:00:00Z  1996-07-23T00:00:00Z  1996-07-15T00:00:00Z  1996-07-17T00:00:00Z  1996-07-22T00:00:00Z 
      jorders.⍙⍙64⍙odata⍙46⍙nextLink
Orders?$skiptoken=10447
      ⎕←orders2←HttpCommand.Get service,'/',jorders.⍙⍙64⍙odata⍙46⍙nextLink
[rc: 0 | msg:  | HTTP Status: 200 "OK" | ⍴Data: 71078]
      jo2←⎕json orders2.Data
      ⍴jo2.value
200
      ⎕←t←HttpCommand.Get service,'/Orders/$count'
[rc: 0 | msg:  | HTTP Status: 200 "OK" | ⍴Data: 3]
      t.Data
830
      params←1 2⍴   '$select' 'OrderID,ShippedDate'
      params⍪←  '$filter' 'ShippedDate ge 1997-07-01 and ShippedDate lt 1997-08-01'
      ⎕←july97←HttpCommand.Get (service,'/Orders') (params)
[rc: 0 | msg:  | HTTP Status: 200 "OK" | ⍴Data: 1827]
      jjuly97←⎕json july97.Data
      ObjIn jjuly97
 value  ⍙⍙64⍙odata⍙46⍙context 
      ObjIn jjuly97.value
 OrderID  ShippedDate 
      ⍴jjuly97.value
31
      jjuly97.value.ShippedDate
 1997-07-09T00:00:00Z  1997-07-11T00:00:00Z  1997-07-04T00:00:00Z  1997-07-25T00:00:00Z  1997-07-04T00:00:00Z  1997-07-01T00:00:00Z  1997-07-02T00:00:00Z  1997-07-14T00:00:00Z  1997-07-04T00:00:00Z  1997-07-04T00:00:00Z  1997-07-10T00:00:00Z  1997-07-09T00
      :00:00Z  1997-07-09T00:00:00Z  1997-07-10T00:00:00Z  1997-07-14T00:00:00Z  1997-07-14T00:00:00Z  1997-07-16T00:00:00Z  1997-07-16T00:00:00Z  1997-07-16T00:00:00Z  1997-07-14T00:00:00Z  1997-07-18T00:00:00Z  1997-07-18T00:00:00Z  1997-07-21T00:00:00Z 
       1997-07-21T00:00:00Z  1997-07-22T00:00:00Z  1997-07-22T00:00:00Z  1997-07-29T00:00:00Z  1997-07-29T00:00:00Z  1997-07-31T00:00:00Z  1997-07-25T00:00:00Z  1997-07-30T00:00:00Z 
      1 HttpCommand.Get (service,'/Orders') (params)
GET /V4/Northwind/Northwind.svc/Orders?%24select=OrderID%2CShippedDate&%24filter=ShippedDate%20ge%201997-07-01%20and%20ShippedDate%20lt%201997-08-01 HTTP/1.1

Host: services.odata.org

User-Agent: Dyalog/HttpCommand

Accept: */*




      params←1 2⍴   '$select' 'OrderID,ShippedDate'
      params⍪← '$filter' 'month(ShippedDate) eq 7 and year(ShippedDate) eq 1997' 
      params⍪←'$expand' 'Order_Details'
      ⎕←t ←HttpCommand.Get (service,'/Orders') (params)
[rc: 0 | msg:  | HTTP Status: 200 "OK" | ⍴Data: 7814]
      jt←⎕Json t.Data
      ⍴jt.value
31
      ObjIn jt.value
 OrderID  Order_Details  ShippedDate 
      ObjIn jt.value.Order_Details
  Discount  OrderID  ProductID  Quantity  UnitPrice    
      params⍪←'$compute' 'Order_Details/Quantity mul Order_Details/UnitPrice as Amount'
      ⎕←t ←HttpCommand.Get (service,'/Orders') (params)
[rc: 0 | msg:  | HTTP Status: 400 "Bad Request" | ⍴Data: 131]
      t.Data
{"error":{"code":"","message":"The query parameter '$compute' begins with a system-reserved '$' character but is not recognized."}}
      params←¯1↓params
      ⎕←t ←HttpCommand.Get (service,'/Orders') (params)
[rc: 0 | msg:  | HTTP Status: 200 "OK" | ⍴Data: 7814]
      jt←⎕json t.Data
      jt.value.Order_Details.(Quantity×(1-Discount)×UnitPrice)
 155  350 540  217.3875 333.2  360 117  155 162.75  331.3125 82.5075 599.925  310  78 252  1237.9 693.6 306  593.75  142.5  23.8  187.38 360 260  2000 1120  72  360 741  140 300 372.5  368.125 148.3425  168 397.5  405 2565 1755  126 390 202.08  2195 193.5 
       493  29.8 450  360 1925  48.75  68.85 162  497.325 1045 2261 306.375  352 384 394.4  1350 3900 35 772.8 417.6  54 310 60 
      ⍴¨jt.value.Order_Details.(Quantity×(1-Discount)×UnitPrice)
 1  2  2  2  2  3  1  2  3  1  1  1  3  2  1  2  3  2  2  3  3  2  1  2  2  1  2  4  3  5  3 
      +/⊃,/jt.value.Order_Details.(Quantity×(1-Discount)×UnitPrice)
37544.96
      ⍝ exercise