2
votes

I am getting a correct response when using Postman but when I use the generated restsharp code in Postman i get the following as a response "Not available at this moment".

The generated Code is the following:

var client = new RestClient("https://allevents.in/api/index.php/events/web/q");
var request = new RestRequest(Method.POST);
request.AddHeader("Postman-Token", "e35b163d-19b5-bb1d-ddcc-b547411efeac");
request.AddHeader("Referer", "allevents.in");
request.AddHeader("Cache-Control", "no-cache");
request.AddHeader("Accept", "application/json");
request.AddHeader("scheme", "https");
request.AddHeader("path", "/api/index.php/events/web/q");
request.AddHeader("method", "POST");
request.AddHeader("autority", "allevents.in");
request.AddParameter("undefined", "{\"venue\":\"0\",\"ids\":\"0\",\"type\":\"json\",\"city\":\"luxembourg\",\"edate\":\"\",\"page\":\"0\",\"keywords\":\"0\",\"sdate\":\"\",\"category\":\"parties\",\"city_display\":\"luxembourg\"}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);

I have tried clearing the default parameters but had no success.

Thanks in advance

Solved

There were two missing cookies that were not shown in the postman interface.I have found them in the fiddler request and added them to the cookie container.

1

1 Answers

0
votes

Man, try remove the Postman-token.

Before I remove this, I got "Not avaliable", After I remove I got the correct message...

{
  "request": {
    "venue": "0",
    "ids": "0",
    "type": "json",
    "city": "luxembourg",
    "edate": "",
    "page": "0",
    "keywords": "0",
    "sdate": "",
    "category": "parties",
    "city_display": "luxembourg",
    "rows": 50
  },
  "count": 50,
  "item": [
    {
      "event_id": "156123315020311",
      "eventname": "Soho - All Must Dance",
      "eventname_raw": "Soho - All Must Dance",
      "owner_id": "283436232149109",
      "thumb_url": "https://cdn-az.allevents.in/banners/8b8744b8ad6d3e89749c1276d0d37d60-rimg-w200-h200-gmir.jpg",
      .....