• Register

ACTIVE Network API Forums

API Forum

RSS Feed

Search API Inconsistencies

    • Dan LaRiviere
    • Topic created 15 years ago

    I am having an issue trying to deserialize the JSON response from an Active.com Search API call into a .NET object. The problem is being caused by how certain elements in event meta are handled.

    Here is the url call:
    http://api.amp.active.com/search?k=half+marathon&v=xml&api_key=wuhmn9ye94xn3xnteudxsavw&nu&m=4

    My deserialization works fine when I return 3 events, but blows up on the 4th. I tracked the problem down to meta elements that have multiple values (tag, splitMediaType, mediaType, assetId, and assetName). I have these elements being deserialized into a string array.

    In my example query you can see that the results for the Tag element on the first 3 events are returned in a list:
    JSON
    ============
    "tag": [
    "event:10",
    "Running:10"
    ],
    XML
    =============
    <tag>
    <value>event:10</value>
    <value>Running:10</value>
    </tag>

    but then on the 4th event, there is only 1 value for tag, and it changes format:
    JSON
    ============
    "tag": "Running:10",

    XML
    ============
    <tag>Running:10</tag>

    For consistency sake, shouldn't this be
    JSON
    ============
    "tag": [
    "Running:10"
    ],
    XML
    =============
    <tag>
    <value>Running:10</value>
    </tag>

    ...so that it becomes an array with a single element, rather than changing type to be a basic string (not an array).

    Can this be changed? If not, how are other people dealing with this?

    Thanks,

    Dan

    Message edited by Dan LaRiviere 15 years ago

  1. active Admin15 years ago

    Good catch here. This is a known bug and is one we'll be fixing soon. In the meantime, we recommend you test for the data type (array or string) and act accordingly based on the test.

  2. Dan LaRiviere15 years ago

    The problem is that this inconsistency is keeping me from being able to use a native .net json deserializer, and will cause me to have to write my own. Quite a bit more code that I would rather not have to write. We would really like to get our integration up and running asap. If this is going to be fixed soon it would really help me a lot. Do you have a time frame of when I could expect a fix for this?

  3. active Admin15 years ago

    Sorry about the late response here. We're a few weeks away from getting this fixed unfortunately. I'll let you know once we have an ETA.

  4. active Admin15 years ago

    I'm happy to report we fixed this with an API update yesterday. I'll be blogging about it shortly, but you'll find that, when once you found:
    <tag>Running:10</tag>

    You'll now find:
    <tag>
    <value>Running:10</value>
    </tag>

[ Page 1 of 1 ]