1

On /users/{id}/badges, the description of the id parameter

a semicolon delimited list of user ids

diverges from the inferred standard for multi-valued parameters:

A single primary key identifier or a vectorized, semicolon-delimited list of identifiers.

Is this intentional and is there a difference in the way "list" parameters are handled vs "vectorized" parameters?

It is my understanding that "vectorized" means that constituent values must be sorted in ascending order. Is this correct?

UPDATE:

Upon dumping all parameters I've come up with these variants:

id  string  A single primary key identifier or a vectorized, semicolon-delimited list of identifiers.
id  string  a semicolon delimited list of user ids
id  string  semi-colon delimited list of post ids

Can these all be treated similarly?

Conclusion

I got the answer I was looking for and am able to generate code that passes the following tests:

Tags (arbitrary number of strings):

[Test]
public void CheckParamArrayTags()
{
    var client = new SoapiClient("api.stackoverflow.com", "");

    QuestionsTaggedByTagsResponse response = client.QuestionsTaggedByTags("sqlite", "sqlite3", "c#").GetResult();


    Assert.Greater(response.Questions.Count,0);

    Assert.IsTrue(
        response.Questions.All(
            q => q.Tags.Contains("sqlite") && q.Tags.Contains("sqlite3") && q.Tags.Contains("c#")));
}

Ids (arbitrary number of int32)

[Test]
public void CheckParamArrayId()
{

    var client = new SoapiClient("api.stackoverflow.com", "");

    UsersByIdResponse response = client.UsersById(242897, 1).GetResult();

    Assert.AreEqual(2, response.Users.Count);
    Assert.IsTrue(response.Users.Any(u => u.UserId == 1));
    Assert.IsTrue(response.Users.Any(u => u.UserId == 242897));
}

1 Answer 1

1

"Vectorized" does not imply anything about the order of its constituent components. The name comes from Vector Processors, a nicer name for the SIMD scheme.

The parameters are all treated identically, the documentation for each will be brought into sync on the next code push.

7
  • I seem to remember porting one of your unit tests that indicate that int.max;0 would return an error? Jun 6, 2010 at 4:04
  • So, to generate param array factory methods I am going to key off of "semi[\s-]colon[\s-]delimited" - sound safe? Jun 6, 2010 at 4:07
  • @code poet - Int32.MaxValue;0 would have returned a 404 error because nothing would have those 2 ids. I don't really follow your second question. Jun 6, 2010 at 4:12
  • I was asking if it would be future proof to use the presense of 'semicolon delimited', in any format, as an indication that an array is acceptable in the interest of generating methods with param array for ids and tags and such. Jun 6, 2010 at 4:45
  • @code poet - yes, that will probably work; though I obviously can't make hard promises about the far future. If it works on the API as it stands now, it will almost certainly work for the v1 release however. Jun 6, 2010 at 6:18
  • perfect. that is all I would expect. Jun 6, 2010 at 6:49
  • 1
    check the conclusion of this question for an explaination of the motivation. Jun 7, 2010 at 2:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .