Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "external_datasets" field to Revision #65

Closed
wants to merge 5 commits into from

Conversation

evantayloryates
Copy link

Resolves #45

If you look at the code for Revisions.new:

@staticmethod
def new(auth, metadata):
    path = 'https://{domain}/api/publishing/v1/revision'.format(
        domain = auth.domain,
    )

    response = post(
        path,
        auth = auth,
        data = json.dumps({
            'action': {
                'type': 'update'
            },
            'metadata': metadata
        })
    )
    return Revision(auth, response)

The revision's JSON data has two top-level attributes, action and metadata. However, if you look at Socrata's Publishing api (which socrata-py wraps around), you'll see that in order to add an external URL, you need a third top-level attribute, href (pictured below).

Socrata Publishing API

I've added a small amount of code to allow users to specify external datasets when creating new Revisions

Evan Taylor Yates and others added 5 commits October 27, 2020 17:02
This will be to match the new 'external_datasets'  field for Revisions.new function
These external dataset JSON objects are described in Socrata's Publishing API (https://socratapublishing.docs.apiary.io/#reference/0/inputschema) as the 'href' top-level JSON key. I added the optional function arg and placed it inside the Revisions data JSON object.

Also added docstring for Revisions.new
Merge commits made on 'master' into 'patch-1'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to create an external dataset, using Python
2 participants