1

It doesn't say this explicitly in the docs (or at least I didn't notice it!). It seems to be the case that empty parameters are ignored. This seems to be a desirable behavior, as it makes fogbugz clients simpler to write.

i.e., sCategory and sPersonAssignedTo in this example:

http://spolsky/api.asp?sArea=&cmd=edit&sCategory=
     &token=jkqn4hqh5ha4n6o8udntev9e2gtvc2&sProject=Inbox
     &ixBug=164&sPersonAssignedTo=

As an example of how it makes code easier to write, consider this code which encodes a dictionary of parameters. It's not hard to iterate through the dictionary and remove zero-length entries, but it's nice not to have to do so.

    #-------------------------------------------------- edit item
    resp=fb.sendit('%s/%s%s'%(admin_login[0],api_url,urllib.urlencode({
        'token'             : tok,
        'cmd'               : 'edit',
        'ixBug'             : case,
        'sProject'          : opts.p,
        'sArea'             : opts.a,
        'sCategory'         : opts.c,
        'sPersonAssignedTo' : opts.P,
        'sTitle'            : title,
    })))

Can somebody confirm or deny, and update the API doc accordingly?

http://www.fogcreek.com/FogBugz/docs/70/topics/advanced/API.html

flag
You can simply skip empty parameters. In my code, I only send non-empty parameters. If I don't want to change something, I don't sent it at all. This works for me. – Peter Štibraný Nov 17 2009 at 9:48
True... I've updated with an example of where my code is a bit more tidy if I don't have to remove empty parms. – Mark Harrison Nov 17 2009 at 10:17

1 Answer

1

Correct. Empty parameters are the same as not having the parameter.

link|flag

Your Answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.