Search code examples
socratasoda

Socrata Open Data API Resource ID Generation


I am new to Socrata Open Data. I am trying to access a dataset from NYC DOB Violations. I registered myself and have an App Token and I know the endpoint.

public ResourceMetadata GetMetadata(string resourceId)
    {
        if (FourByFour.IsNotValid(resourceId))
            throw new ArgumentOutOfRangeException("resourceId", "The provided resourceId is not a valid Socrata (4x4) resource identifier.");

        var uri = SodaUri.ForMetadata(Host, resourceId);

        var metadata = read<ResourceMetadata>(uri);
        metadata.Client = this;

        return metadata;
    }

How do I get the resource ID? I have a dataset I am interested in and I would like to Programmatically download the file every month? I downloaded the .Net Library and SDK but am not able to figure out a way to do that . Please help.


Solution

  • You can get the resource identifier from the API docs for that dataset:

    https://dev.socrata.com/foundry/data.cityofnewyork.us/dvnq-fhaa

    The identifier is the eight alphanumeric questions separated into two groups of four after /resource/. For that dataset, it would be dvnq-fhaa.

    Good luck!