Coder Social home page Coder Social logo

Comments (4)

lildude avatar lildude commented on August 18, 2024 1

AHH sorry... that did work...

🎉 Good to hear it.

Now if we can just get SMUG to speed up their API... sheesh... a simple get 2 albums info takes 10 seconds to load. And i just want to display some pictures on a website.

I hear you 😞. When I first switched to using Guzzle for the HTTP requests I did a little experimenting with caching with a few different Guzzle-compatible caching modules but found I needed to get hacky or overly loose with the caching as SmugMug's headers don't encourage clean caching. Using a local DB or storing the response in a local JSON file is probably the least hacky and most performant of all options at the moment.

I'm gonna close this issue now as the initial issue is now resolved.

from phpsmug.

joeporterme avatar joeporterme commented on August 18, 2024

its doesnt like the encoded "+" symbol you are doing...

from phpsmug.

lildude avatar lildude commented on August 18, 2024

This is where phpSmug is making your life easy and assumes you have no knowledge about encoding the params as there is no documentation that manual encoding is required within the SmugMug API docs.

The API itself suggests manual encoding of options is not required so phpSmug passes this on to you and expects you to use the options exactly as they're returned by the API.

So in the case of ordering, the API supports the following (taken from the JSON from https://api.smugmug.com/api/v2/user/{username}!albums#json):

"Parameters": {
    "GET": [
        {
            "Name": "Order",
            "Required": false,
            "ReadOnly": false,
            "Default": "",
            "Description": "Order Albums By",
            "Type": "Select",
            "OPTIONS": [
                "Album Settings",
                "Position",
                "Last Updated (Descending)",
                "Last Updated (Ascending)",
                "Date Added (Descending)",
                "Date Added (Ascending)"
            ],
            "MIN_COUNT": 1,
            "MAX_COUNT": 1
        },
        {
            "Name": "MinimumImages",
            "Required": false,
            "ReadOnly": false,
            "Default": 0,
            "Type": "Integer",
            "MIN_VALUE": 0,
            "MAX_VALUE": 16777215
        }
    ]
},

From this output, you can see the ordering string is Date Added (Descending).

Use that exactly (I've removed default options)...

$albums = $client->get("user/{$username}!albums", array('count' => 2, 'Order'=>'Date Added (Descending)'));

... and you'll get the response you expect.

from phpsmug.

joeporterme avatar joeporterme commented on August 18, 2024

AHH sorry... that did work...

Now if we can just get SMUG to speed up their API... sheesh... a simple get 2 albums info takes 10 seconds to load. And i just want to display some pictures on a website.

Im probably going to have to just sync all the data to a database and have the front end query that database instead of SMUG API

from phpsmug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.