Please refrain from posting animated GIFs, memes, joke videos and so on in discussions other than those in the off topic area.

Dismiss this message to confirm your acceptance of this additional forum term of use.

How do I make an API call to getSets?

HartleySanHartleySan USAMember Posts: 20
In the API documentation (https://brickset.com/tools/webservices/v2), it says the following for the getSets method:
Retrieve a list of sets. All parameters except apiKey are optional but must be passed as blanks if not used.

What does "but must be passed as blanks if not used"? Does that mean that the parameters should not be specified? Does that mean that they should be specified but set to null? Does that mean that they should be specified but set to empty strings?

Also, if only the API key is pasted, will that return all sets registered on Brickset?

Thanks.

Comments

  • HartleySanHartleySan USAMember Posts: 20
    To provide some more information, I'm using PHP to make the API SOAP calls and all of the following calls work just fine every time:

    //Returns "OK".
    $result => $client->checkKey([
      'apiKey' => $apiKey
    ]);

    //Returns userHash string.
    $result = $client->login([
      'apiKey' => $apiKey,
      'username' => $username,
      'password' => $password
    ]);

    //Returns "HartleySan" (me).
    $result = $client->checkUserHash([
      'userHash' => $userHash
    ]);

    //Returns collection totals for me.
    $result = $client->getCollectionTotals([
      'apiKey' => $apiKey,
      'userHash' => $userHash
    ]);

    //Returns additional image info for set 27611.
    $result = $client->getAdditionalImages([
      'apiKey' => $apiKey,
      'setID' => 27611
    ]);

    //Returns all theme info.
    $result = $client->getThemes([
      'apiKey' => $apiKey
    ]);

    //Return year info for "Teenage Mutant Ninja Turtles" theme.
    $result = $client->getYears([
      'apiKey' => $apiKey,
      'theme' => 'Teenage Mutant Ninja Turtles'
    ]);

    //Returns all updated sets in the last 40 minutes.
    //This is where I got setID 27611 from.
    $result = $client->getRecentlyUpdatedSets([
      'apiKey' => $apiKey,
      'minutesAgo' => 40
    ]);

    However, the following call returns nothing, and I can't figure out why:

    $result = $client->getSet([
      'apiKey' => $apiKey,
      'setID' => 27611
    ]);

    It's weird because I have confirmed with the successful API calls above that 27611 is indeed a valid setID value.

    Why is the getSet API call not working, and to my original question, how do I need to format the parameters for getSets in order to get data back?

    Thank you.
  • HuwHuw Brickset Towers, Hampshire, UKAdministrator Posts: 6,299
    I wish I could answer but I've not actually used the API myself!


  • HartleySanHartleySan USAMember Posts: 20
    Well, you may want to look into it (or whoever developed it might want to) because I'm wondering if it's broken / has a bug. What I'm trying to say is that most of the API calls work, but the getSets and getSet calls don't seem to work, even though I'm passing the same parameters to those as other API calls that definitely work.
  • HuwHuw Brickset Towers, Hampshire, UKAdministrator Posts: 6,299
    Don't worry, they work, and are being used successfully by the many apps that are out there.
  • canon03canon03 USAMember Posts: 319
    @HartleySan They work and I'm also using PHP.   I'll try and provide an example a little later.
  • HartleySanHartleySan USAMember Posts: 20
    If they work, then could you please offer some feedback as to why they're not working for me or refer me to someone that could help?

    It's certainly possible that I'm messing something up, but it is strange that getSet and getSets don't work for me, even though all the others do and the parameters (at least for getSet) are the same as other calls I'm making that work.
  • HartleySanHartleySan USAMember Posts: 20
    Thanks, canon03. You commented at the same time I did and I didn't see it. Thank you.
  • HartleySanHartleySan USAMember Posts: 20
    Well, I figured out the "problem" with getSet at least: The setID parameter has to be written as SetID (with an uppercase S), even though the docs specify it with a lowercase s. I looked directly at the WSDL and noticed the difference.

    Still working on getting getSets to work though.
    Thanks.
  • HartleySanHartleySan USAMember Posts: 20
    All right. I'm confused. Didn't change a darn thing in my code, but getSets suddenly started working. All the same, I suppose I'm satisfied for now (assuming getSets continues to work).

    Thanks a lot for everyone's help.
Sign In or Register to comment.
Recent discussions Categories Privacy Policy