Ravindra Yadav

Ravindra Yadav

  • NA
  • 35
  • 1.1k

facing issue while creating request format to call api

Jul 17 2020 3:56 AM
Hi All,
 
Below code is my request format expected by api
 
{
utilityProductMatch(sites: [
{
utilityId: "96d83432",
constraints: [
"Commercial"
],
products: [
{
productId: YZZ
existingProductCategory: "test",
equivalentWatts: 500,
operatingHours: 1800,
fixtureType: "test1"
}
]
}
])
{
utilityId
}
}
 
currently i created request format is below, now i m not able to understand how i can i append my below request on "utilityProductMatch" as mention in above.
 
{
"sites": [
{
"utilityId": "19dbc535a",
"constraints": {
"commercial": true
},
"products": [
{
"productId": "XYZ",
"existingProductCategory": "test",
"equivalentWatts": 500,
"operatingHours": "1800",
"FixtureType": "Lamp"
}
]
}
]
}
 
my classes are below to create current request format
  1. public class GetCreateRequest  
  2. {  
  3. public List<Site> sites { getset; }  
  4. }  
  5. public class Site  
  6. {  
  7. public string utilityId { getset; }  
  8. public ProgramConstraints constraints { getset; }  
  9. public List<Product> products { getset; }  
  10. }  
  11. public class ProgramConstraints  
  12. {  
  13. public bool commercial  
  14. {  
  15. get;  
  16. set;  
  17. }  
  18. }  
  19. public class Product  
  20. {  
  21. public string productId { getset; }  
  22. public string existingProductCategory { getset; }  
  23. public int equivalentWatts { getset; }  
  24. public string operatingHours { getset; }  
  25. public string FixtureType { getset; }  
  26. }  
please suggest where i need to change in existing request format, so i will create request format as api expected.

Answers (1)