title: CDON API RESTful Api GET request
body: <p>I'm currently working on fetching customer data from cdon, it's an e-commerce platform. They have their API documentation here: </p>
  
  <p><a href="http://docs.marketplace.cdon.com/en/master/Reports/api/fetchreport/#order-report-attributes" rel="nofollow noreferrer">CDON Api Docu</a></p>
  
  <p>First let me show you my code:</p>
  
  <pre><code>myToken = '&lt;token here&gt;'
  myUrl = 'https://admin.marketplace.cdon.com/api/reports/d8578ef8-723d-46cb-bb08-af8c9b5cca4c'
  head = {'Authorization': 'token {}'.format(myToken),
  'Status':'Online',
  'format':'json'}
  filters = '?filter={"Status":["Online"],"format": ["json"] }}'
  response = requests.get(myUrl + filters, headers=head)
  report = response.json()
  print(report.products)
  </code></pre>
  
  <p>This is returning only the parameters. like for example at at this JSON: <a href="https://github.com/cdon-dev/ma-docs/blob/master/Reports/api/fetchfilterforreporttype.rst" rel="nofollow noreferrer">CDON Github</a></p>
  
  <p><strong>Status</strong> has a value <strong>Online</strong> this <code>online</code> is a group of itemsthat I only want to get.</p>
  
  <p>What I'm trying to get is a response like this:</p>
  
  <pre><code>{
  
    "Products": [
  
      {
  
        "SKU": "322352",
  
        "Title": "Fabric Cover",
  
        "GTIN": "532523626",
  
        "ManufacturerArticleNumber": "",
  
        "StatusCDON": "Online",
  
        "ExposeStatusCDON": "Buyable",
  
        "InStock": 0,
  
        "InStockCDON": 0,
  
        "CurrentPriceSE": null,
  
        "OrdinaryPriceSE": null,
  
        "CurrentPriceCDONSE": 299.0000,
  
        "OrdinaryPriceCDONSE": null,
  
        "CurrentPriceDK": null,
  
        "OrdinaryPriceDK": null,
  
        "CurrentPriceCDONDK": null,
  
        "OrdinaryPriceCDONDK": null,
  
        "CurrentPriceNO": null,
  
        "OrdinaryPriceNO": null,
  
        "CurrentPriceCDONNO": null,
  
        "OrdinaryPriceCDONNO": null,
  
        "CurrentPriceFI": null,
  
        "OrdinaryPriceFI": null,
  
        "CurrentPriceCDONFI": null,
  
        "OrdinaryPriceCDONFI": null
  
      },
  </code></pre>
  
  <p>Which means the full list of the items that are <strong>Online</strong> </p>
  
  <p>How should I put this... among all the API's I tried this one is very confusing, is this even RestFul? If I can achieve the python equivalent of this C# sample code:</p>
  
  <pre><code>public string Post(Guid repordId, string path)
  {
    var filter = new JavaScriptSerializer().Serialize(new
    {
           States = new[] { "0" } // Pending state
    });
  
    var content = new FormUrlEncodedContent(new[]
    {
           new KeyValuePair("ReportId", repordId.ToString()),
           new KeyValuePair("format", "json"),
           new KeyValuePair("filter", filter)
    });
  
    var httpClient = new HttpClient() { BaseAddress = new Uri("https://admin.marketplace.cdon.com/") };
    httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("api", ApiKey);
    var response = httpClient.PostAsync(path, content).Result;
    response.EnsureSuccessStatusCode();
  
    return response.Content.ReadAsStringAsync().Result;
  }
  </code></pre>
  
  <p>I may be able to undestand how this API works, the response that I got was taken manually from their report function in JSON format. </p>
  
  <p><a href="https://i.stack.imgur.com/jJm5v.png" rel="nofollow noreferrer">Image</a></p>
  
  <p>I made many attempts and at that code ( my code ) I stopped, being on this for 4 hours made me give up and ask. Trust that I have searched as many references as I could. It's really confusing.</p>
  
  <p>How do I get the response that I want? Filtering via url? or via header? is this even restful? Help T_T</p>