Search code examples
c#socratasoda

System.ArgumentOutOfRangeException: 'The provided resourceId is not a valid Socrata (4x4) resource identifier


I'm trying to pull data from this dataset. I'm getting the following exception from this method, "System.ArgumentOutOfRangeException: 'The provided resourceId is not a valid Socrata (4x4) resource identifier. (Parameter 'resourceId')'" but as you can see from the link , the resourceID is correct. What am I doing wrong here?

public static List<Submission> GetSubmissions()
    {
        var Client = new SodaClient("https://data.cdc.gov/resource/");

        var Dataset = Client.GetResource<List<Submission>>("9mfq-cb36");

        string[] Columns = new[] { "submission_date", "state", "tot_cases", "conf_cases", "prob_cases", "new_case", "pnew_case", "tot_death", "conf_death", "prob_death", "new_death", "pnew_death", "created_at", "consent_cases", "consent_deaths" };

        var SOQL = new SoqlQuery().Select(Columns).Where("submission_date=" + DateTime.Today.Date.ToString());

        var Results = Dataset.Query<Submission>(SOQL); //<--- Exception occurs at this line!

        List<Submission> SubmissionsList = Results.ToList();

        return SubmissionsList;
    }

Solution

  • I was able to resolve this exception by adding an app token argument to the Soda Client initialization. This is apparently required for this dataset, although Socrata documentation says otherwise.