Check out the latest documentation.

Accessing Metadata

What is metadata?

Metadata is a human-readable description of our device properties and a set of possible values these properties can take. Each 51degrees data file has metadata description built in to it.

Where can metadata be used?

Metadata has many uses. One of the most common scenarios is to use metadata to describe the meaning of fields when producing a report from data. Metadata can help with creating an interface for setting up detection and/or redirection rules by providing a meaningful information about a particular property.

Accessing the metadata

All metadata is part of the specific Property object. The following example retrieves description and values for the " IsMobile " Property. The example is using ASP server script.

										
										<%
										
									 =FiftyOne.Foundation.Mobile.Detection.WebProvider.ActiveProvider.DataSet.GetProperty(
										
										"IsMobile"
										
									).Description 
										
										%>
										
										
										<%
										
									 =FiftyOne.Foundation.Mobile.Detection.WebProvider.ActiveProvider.DataSet.GetProperty(
										
										"IsMobile"
										
									).Values 
										
										%>
										
									

The following snippet prints out Property name, Property description and a list of possible values the property can return. The example is using ASP server script

										
										<table>
										
										
										<tr>
										
										
										<th>
										
									Property name:
										
										</th>
										
										
										<th>
										
									Property description:
										
										</th>
										
										
										<th>
										
									Possible Values:
										
										</th>
										
										
										</tr>
										
										
										<%
										
										
										foreach
										
									 (FiftyOne.Foundation.Mobile.Detection.Entities.Property p 
	   
										
										in
										
									 FiftyOne.Foundation.Mobile.Detection.WebProvider.ActiveProvider.DataSet.Properties)
   {
	
										
										%><tr>
										
										
										<td><%=
										
									p.Name 
										
										%>
										
									>
										
										</td>
										
										
										<td><%=
										
									p.Description 
										
										%>
										
									>
										
										</td>
										
										
										<td><%=
										
									p.Values 
										
										%>
										
									>
										
										</td>
										
										
										</tr><%
										
									
   } 

										
										%>
										
										
										</table>