It's all about the answers!

Ask a question

How to get Category Name by passing Category uuid (using Java Client Plain API)


Rajat Krishnan (7015) | asked Jan 09 '21, 12:40 p.m.
edited Jan 09 '21, 1:07 p.m.
Hello Community,
 I am trying to fetch category name using category uuid as a input parameter , is it possible ?

As Solution ,I am already using hashmap to store categorylist as key and category uuidList as value and matching user input uuid with hashmap value and i am able to get category name , but was just curious to know is there any way by i can fetch category name using category uuid as a input parameter?

Thank you

Accepted answer


permanent link
Ralph Schoon (63.1k33645) | answered Jan 11 '21, 2:42 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
You can create an item handle based on the UUID and once you have the handle you can resolve the item.

ICategory.ITEM_TYPE.createItemHandle(UUID.valueOf(uuid_string), null);
Rajat Krishnan selected this answer as the correct answer

Comments
Rajat Krishnan commented Jan 11 '21, 2:49 a.m.
Hi Ralph ,
This worked for me
Thank you very much

One other answer



permanent link
Steven Roger (11) | answered Jan 20 '21, 10:08 a.m.

 The only alternative I know of (using core functions) is:

// Get terms whose name begins with "my_name"
get_terms( 'category', array( 'name__like' => 'my_name' ) );

// Get terms whose name contains "my_name" get_terms( 'category', array( 'search' => 'my_name' ) );

If you need an exact match, you'll have to execute a custom query.

$wpdb->get_results( "SELECT t., tt. FROM $wpdb->terms AS t
    INNER JOIN $wpdb->term_taxonomy AS tt ON t.term_id = tt.term_id
    WHERE tt.taxonomy = 'category' AND t.name = 'my_name'"
);

    
<time datetime="2012-07-21T23:15:15" itemprop="dateCreated" style="border: 0px; box-sizing: inherit; font-family: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </time>


Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.