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

Support v2 of Smugmug API #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sntran
Copy link
Member

@sntran sntran commented Mar 31, 2017

Usage:

  smugmug: {
    "resource": smugmug.v2["user!albums"],
    "params": {
      "NickName": "sanjacinto-museum",
      "APIKey": "fSMJ7g7ju5aZgYsNiMl3PstAQYzmbg9L",
      "Order": "Album+Settings"
      // "count": 7
    },
    "auth": {
      "type": "oauth",
      "provider": "smugmug"
    },
    "cleanup": function(data) {
       // `data` contains "Albums" and "Total" keys.
    }
  }

Smugmug API v2 supports a "_config" object to effectively perform
actions to multiple endpoints within a single request. Theoretically,
I could get all the data in one request. However, their server did
not handle that much (i.e. Sanjac), and the request timeout'ed.

Therefore, I have to split the request into pages. Except the first
request, which tells us the total albums and the number of albums
per page, all other requests are performed in parallel.

The number of requests is:

1 + N/X, in which N is the total number of albums, and X is the
amount of albums per page, usually 50.

Usage:

```js
  smugmug: {
    "resource": smugmug.v2["user!albums"],
    "params": {
      "NickName": "sanjacinto-museum",
      "APIKey": "fSMJ7g7ju5aZgYsNiMl3PstAQYzmbg9L",
      "Order": "Album+Settings"
      // "count": 7
    },
    "auth": {
      "type": "oauth",
      "provider": "smugmug"
    },
    "cleanup": function(data) {
       // `data` contains "Albums" and "Total" keys.
    }
  }
```

Smugmug API v2 supports a "_config" object to effectively perform 
actions to multiple endpoints within a single request. Theoretically,
I could get all the data in one request. However, their server did
not handle that much, and the request timeout'ed.

Therefore, I have to split the request into pages. Except the first
request, which tells us the total albums and the number of albums
per page, all other requests are performed in parallel.

The number of requests is:

`1 + N/X`, in which N is the total number of albums, and X is the
amount of albums per page, usually 50.
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.

1 participant