If you don't find an answer, please click here to post your question.
Reply
Advisor
Posts: 19
Registered: ‎03-05-2013

Label Full Name

I am in need of an example to include the `fullname` (qualified path) of a label.

 

I have a singular label query working great, but have been unsuccessful at string a hierarchical path of labels together.

 

For example, in our master account, we have two similar labeling structures:

 

Group1/Webinars/January 2012

Group2/Webinar/January 2012

 

This works but displays both sets of January 2012 assets:

 

$label_name = $customfield['label_name']; // January 2012

 

$parameters = array("where" => "labels INCLUDES '{$label_name}' AND asset_type='video' AND status='live'","orderby" => "name ASC");

 

I've tried:

 

"where"=>"labels INCLUDES 'Group1' AND labels INCLUDES 'Webinars' AND labels INCLUDES '{$label_name}..."

"where"=>"labels INCLUDES 'Group1%2FWebinars%2F{$label_name}..."

 

with no success.

 

Any thoughts?

 

Thanks,

Greg

 

Advisor
Posts: 19
Registered: ‎03-05-2013

Re: Label Full Name

when I run:

/v2/labels/

in scratchpad, I can see that I need the variable `fullname`, but can't get the syntax correct...
Ooyalan
Posts: 152
Registered: ‎06-18-2012

Re: Label Full Name

Hi Beer,


Thanks for your post.

 

The "INCLUDES" parameter searches for a matching text in the labels' name when querying for assets, currently it can't be used to query for the Full Path.

 

Instead you could use the  query to get the label by full path, the API Call would be as following:

 

[GET] /v2/labels/by_full_path/:paths

where :paths is a comma-separated list of label paths (they need to be CGI Escaped).

 

You can learn more about the supported label queries in here.

 

Please let me know if you have any further questions.

 

Regards,

Azul Islas

Ooyala Technical Support

 

 

 

 

Please show your appreciation to others. If someone helps you, don't forget to give them Kudos by clicking the star button next to their post. If a post answers your question, please mark it as an "Accepted Solution."
Advisor
Posts: 19
Registered: ‎03-05-2013

Re: Label Full Name

[ Edited ]

So would this be correct:

 

<pre>

$label_name = $custom_field[0]['field_name'];

 

$l_param = array("where"=>"by_full_path='%2FTop%20Level%2FNext%20Level%2F'{$label_name}'");

// ^^^^^^^^^^^^^^^^^^^^^^ This is what I need an example of ^^^^^^^^^^^^^^^^^^^^^^

 

$o_label = $api->get("labels",$l_param);

$labels = $o_lable->items;

foreach($labels as $label) {

  $label_id = $label->id;

}

</pre>

 

Then it looks like I would need to use $label_id to get the array of assets:

<pre>

[GET] /v2/labels/:label_id/assets

</pre>

 

but am not sure how to formulate that query either.

 

Can you give me an example please?

 

Thanks.

Ooyalan
Posts: 152
Registered: ‎06-18-2012

Re: Label Full Name

Thanks Beer,

 

In this specific case you could the following call to get the labels:

 

GET /v2/labels/by_full_path//Group1/Webinars/January%202012,/Group2/Webinar/January%202012

 

The result will show the details of each label, as:

{
 "items": [   {
   "id": "labelID",
   "name": "January 2012",
   "full_name": "Group1/Webinars/January 2012",
   "parent_id": "parentLabelID"
  },   {
   "id": "labelID"",
   "name": "January 2012",
   "full_name": "Group2/Webinars/January 2012",
   "parent_id": "parentLabelID"
  }  ]
}

 Then with the labelID, you can retrieve the assets for each label with the call you shared.

 

Let me know if you have any other questions.

 

Regards,

Azul Islas

Ooyala Technical Support

 

Please show your appreciation to others. If someone helps you, don't forget to give them Kudos by clicking the star button next to their post. If a post answers your question, please mark it as an "Accepted Solution."
Advisor
Posts: 19
Registered: ‎03-05-2013

Re: Label Full Name

Thanks Azul, but I'd refer to my previous post:

 

$l_param = array("where"=>"by_full_path='%2FTop%20Level%2FNext%20Level%2F'{$label_name}'");

 

                                                   OR

$l_param = array("where"=>"by_full_path='/Top%20Level/Next%20Level/{$label_name}'");

 

       // ^^^^^^^^^^^^^^^^^^^^^^ This is what I need an example of ^^^^^^^^^^^^^^^^^^^^^^ //

 

I'm having trouble getting this into query format and am much need of example. The same would apply with using the returned id for the asset search:

 

$a_param = array("where"=>"label_id='{$lparam['id']}'");

$assets_list = $app->get("assets",$param);

 

Can you help with this?

 

Thanks.

Ooyalan
Posts: 152
Registered: ‎06-18-2012

Re: Label Full Name

Thanks Beer,

 

Can you please confirm the exact query you want to do? Do you want to retrieve the assets that belongs to "Group1/Webinars/January 2012" and the ones that belong to "Group2/Webinar/January 2012"?

 

With the "/v2/assets?where  labels INCLUDES 'yourLabel'" call, you can retrieve the assets that belong to a specific label, if you add the "AND labels INCLUDES 'otherLabel'", the query will only retrieve the assets that have both labels.

 

However, querying as:

 

GET /v2/assets?where labels INCLUDES '/Group1/Webinars/January 2012' AND labels INCLUDES 'Group2/Webinar/January 2012'

 

Is currently not supported, as the INCLUDES doesn't allow us to look by full paths, instead only by using the label's name.

 

Regards,

Azul Islas

Ooyala Technical Support

Please show your appreciation to others. If someone helps you, don't forget to give them Kudos by clicking the star button next to their post. If a post answers your question, please mark it as an "Accepted Solution."
Advisor
Posts: 19
Registered: ‎03-05-2013

Re: Label Full Name

I was simply trying to traverse the path to get to a number of assets that someone did not label correctly. Since I was unable to explain my request well enough to illicit a solution, a colleague showed me how you can do a mass update of labeling and I have moved on. This was not solved and I have to admit my frustration in the post not being read, but maybe it was in error on my part for not explaining well enough.
Ooyalan
Posts: 152
Registered: ‎06-18-2012

Re: Label Full Name

Dear Beer,

 

I apologize for any inconvenience this may have caused you, I believe there was a confusion in the information you were looking for.

 

We do want to provide you the best support experience, so please let us know if there's anything else we can help you with.

 

Best,

Azul Islas

Ooyala Technical Support

Please show your appreciation to others. If someone helps you, don't forget to give them Kudos by clicking the star button next to their post. If a post answers your question, please mark it as an "Accepted Solution."
Senior Member
Posts: 4
Registered: ‎12-19-2017

Re: Label Full Name

Is there any changes in API to achieve this result?

My goal is to receive trending videos (GET /v2/discover/trending) by specific label. But there are enough duplications in label names, so I need to use only full_name or id. Is it possible? Maybe I can pass label Id instead full name?