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

Integrate subscriptions #1079

Closed
Jesus89 opened this issue Oct 9, 2019 · 1 comment
Closed

Integrate subscriptions #1079

Jesus89 opened this issue Oct 9, 2019 · 1 comment
Assignees

Comments

@Jesus89
Copy link
Member

Jesus89 commented Oct 9, 2019

Related to #1055, https://github.com/CartoDB/data-observatory/issues/144

We have a final proposal for the subscriptions (formerly purchases (formerly licenses)).

Explore subscriptions

API

Endpoint

GET /do/subscriptions

Params

  • type: 'dataset' / 'geography' (optional)
  • order: 'project' / 'dataset' / 'table' / 'id' / 'type' (optional)
  • order_direction: 'asc' / 'desc' (optional)

Response

{
 "subscriptions": [
   {
     "project": "carto",
     "dataset": "bbva",
     "table": "financial_spain_2019",
     "id": "carto.bbva.financial_spain_2019",
     "type": "dataset"
   },
   ...
 ]
}

Library

subscriptions = Catalog().subscriptions(credentials)
subscriptions.datasets
subscriptions.geographies

Note: since we have an instance of the Catalog, maybe we can pass the credentials to the constructor subscriptions = Catalog(credentials).subscriptions()

Get subscription info

Endpoint

GET /do/subscription_info

Params

  • id: string
  • type: 'dataset' / 'geography'

Response

   {
     "id": "",
     "estimated_delivery_days": 0,
     "subscription_list_price": 0,
     "tos": "",
     "tos_link": "",
     "licenses": "",
     "licenses_link": "",
     "rights": ""
   }

Errors

  • Wrong id
  • Wrong type

Library

Dataset.get(id).subscription_info(credentials) ?
Geographies.get(id).subscription_info(credentials) ?

Note: these methods must use get_default_credentials if no credentials param is passed.

Subscribe

Endpoint

POST /do/subscriptions

Params

  • id: string
  • type: string

Response

{ ... }

Errors

  • Wrong id
  • Wrong type
  • Already subscribed

Library

Dataset.get(id).subscribe(credentials) 
# /do/subscription_info -> Y/N -> /do/subscribe

Geographies.get(id).subscribe(credentials) 
# /do/subscription_info -> Y/N -> /do/subscribe

Note: these methods must use get_default_credentials if no credentials param is passed.

@Jesus89 Jesus89 self-assigned this Oct 9, 2019
@Jesus89
Copy link
Member Author

Jesus89 commented Oct 10, 2019

@cmongut do you have the texts and format of the subscription info and the license?

>>> Dataset.get('id').subscribe(credentials)
[ Subscription info ]
[ Do you want to continue ] (Y/N)
[ License info ]
[ Do you want to buy it ] (Y/N)
[ Final message (success, warning, error) ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant