Forum Discussion

elbranscomb's avatar
elbranscomb
Executive
3 years ago

Label ID change?

We have been using the Khoros Community API v2 to bring Ideas data into an internal application. 

Recently we noticed that the information pertaining to labels has changed. 

Previously here is an example of what the API returned:

{
    "type": "label",
     "id": "541",
    "text": "Utility Network"
}

And mid September this changed to this:

{
    "type": "label",
     "id": "Utility Network",
    "text": "Utility Network"
}


Was there an API change in a release that is documented somewhere or can provide more information. I checked release notes on 21.7, 21.8 and 21.9 and don't see any mention of changes to label in the API. 


  • SuzieH's avatar
    SuzieH
    3 years ago

    Hi elbranscomb. The documentation and the 21.8 release notes have been updated. (See the API changes section at the bottom.) This was done in a minor release, so most customers will see this change when they upgrade to 21.9.

    There were couple of reasons for the change:

    1) to eventually support labels on draft revisions

    2) to have the text of a label be the same across stage and prod. (The numerical ID is not the same across stage and prod.)

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)

    elbranscomb this change was made in release 21.8 and yes, we now return the text of the label instead of the ID. We will be updating the related documentation and release notes shortly. I apologize that we did not get this information included in the release notes and I'm hoping the change did not cause too many disruptions in your components and other customizations. 

    • elbranscomb's avatar
      elbranscomb
      Executive

      Thanks SuzieH for confirming. If you could let me know when the related documentation and release notes are updated then we can share that back to our internal team. Do you have any information as to why this change was needed? It might be helpful to understand why this change took place.

      • SuzieH's avatar
        SuzieH
        Khoros Alumni (Retired)

        Hi elbranscomb. The documentation and the 21.8 release notes have been updated. (See the API changes section at the bottom.) This was done in a minor release, so most customers will see this change when they upgrade to 21.9.

        There were couple of reasons for the change:

        1) to eventually support labels on draft revisions

        2) to have the text of a label be the same across stage and prod. (The numerical ID is not the same across stage and prod.)

    • elbranscomb's avatar
      elbranscomb
      Executive

      One follow-up question:

      Does this change affect our ability to change an existing label name? If we had a label in use and then decide to alter that label using the Edit Label feature in Admin would the change to the Label ID happen in the 10 minute window that is already mentioned in the hover tip text as below:

      Thanks for your help with this. 

      • DougS's avatar
        DougS
        Khoros Oracle

        It does not affect your ability to change an existing label. However, when you change an existing label it will change the id of that label wherever it is returned by the API. So if you did a LiQL query like this:

         

        SELECT id, href, text FROM labels WHERE messages.id = '5475'

         

        And that returned this:

         

        {
            "status": "success",
            "message": "",
            "http_code": 200,
            "data": {
                "type": "labels",
                "list_item_type": "label",
                "size": 7,
                "items": [
                    {
                        "type": "label",
                        "id": "Utility Network",
                        "href": "/labels/Utility Network",
                        "text": "Utility Network"
                    }
                ]
            }
        }

         

        Then you changed the text of the "Utility Network" label to "Legacy Utility Network" and ran the same LiQL query again, you would get a different id for the label:

         

        {
            "status": "success",
            "message": "",
            "http_code": 200,
            "data": {
                "type": "labels",
                "list_item_type": "label",
                "size": 7,
                "items": [
                    {
                        "type": "label",
                        "id": "Legacy Utility Network",
                        "href": "/labels/Legacy Utility Network",
                        "text": "Legacy Utility Network"
                    }
                ]
            }
        }

         

        I believe we are evaluating changing the id slightly so it's normalized and url-encoded, so we might see an upcoming change where the id becomes "utility%20network" (or "legacy%20utility%20network" if the label gets changed to that).

         

  • SuzieH's avatar
    SuzieH
    Khoros Alumni (Retired)

    Hi elbranscomb . I've sent your question to the Engineering team that maintains the labels feature.

    [FOLLOW-UP] We're collecting information about this change (rationale, when it was implemented, etc)