Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Read single objects via DataContract

The property names (or, if available, the value of the the JsonPropertyAttributes) of the DataContract are used as the property filter.

SDK-Method

Task<TResult> IApiV2Endpoint<TId>.GetByIdAsync<TResult>(
  TId id, 
  CancellationToken cancellationToken = default
)

REST-Equivalent

GET /apiv2/servicedmcore/CoreIdentity/3/
?fields=readonly_display_name,ci_given_name,ci_family_name

Example-Code

public class MyCoreIdentityDataContract
{
	public string ReadonlyDisplayName { get; set; }
	public AccessDeniedHandler<string> CiGivenName { get; set; }

	[JsonProperty("ci_family_name")]
	public AccessDeniedHandler<string> FamilyName { get; set; }
}

public async Task GetCoreIdentityById()
{
	var api = GetService<IApiV2Client>();
	var endpoint = api.DmcoreService.Servicedmcore.CoreIdentity;
	var item = await endpoint.GetByIdAsync<MyCoreIdentityDataContract>(3);
}

Read single objects via template object

The property names of the template object are used as the property filter. Queries for properties which are not valid as a property (e.g. names with spaces) are not possible with this method.

SDK-Method

Task<TResult> IApiV2Endpoint<TId>.GetByIdAsync<TResult>(
  TId id, 
  TResult template, 
  CancellationToken cancellationToken = default
)

REST-Equivalent

GET /apiv2/servicedmcore/CoreIdentity/3/
?fields=readonly_display_name,ci_given_name,ci_family_name

Example-Code

public async Task GetCoreIdentityById()
{
	var api = GetService<IApiV2Client>();
	var endpoint = api.DmcoreService.Servicedmcore.CoreIdentity;
	var item = await endpoint.GetByIdAsync(3, new
	{
		ReadonlyDisplayName = string.Empty,
		CiGivenName = default(AccessDeniedHandler<string>),
		CiFamilyName = default(AccessDeniedHandler<string>),
		GLanguage = default(IDropDownAttributeValue<int>)
	});
}

Read list of objects via DataContract

The property names (or, if available, the value of the JsonPropertyAttributes) of the DataContract are used as the property filter.

SDK-Method

IPagedAsyncEnumerable<TResult> IApiV2Endpoint.GetListAsync<TResult>(
  Action<ListOptions<IListModifier>> options = null, 
  CancellationToken cancellationToken = default
);

REST-Equivalent

No exact equivalent available because IPagedAsyncEnumerable<TResult> carries out paging in the background and further entries are loaded if necessary.

GET /apiv2/servicedmcore/CoreIdentity
?fields=readonly_display_name,ci_given_name,ci_family_name

Example-Code

public class MyCoreIdentityDataContract
{
	public string ReadonlyDisplayName { get; set; }
	public AccessDeniedHandler<string> CiGivenName { get; set; }

	[JsonProperty("ci_family_name")]
	public AccessDeniedHandler<string> FamilyName { get; set; }
}

public async Task GetCoreIdentityList()
{
	var api = GetService<IApiV2Client>();
	var endpoint = api.DmcoreService.Servicedmcore.CoreIdentity;
	var items = await endpoint.GetListAsync<MyCoreIdentityDataContract>().ToArray();
}

Read list of objects via template object

The property names of the template object are used as the property filter. Queries for properties which are not valid as a property (e.g. names with spaces) are not possible with this method.

SDK-Method

IPagedAsyncEnumerable<TResult> IApiV2Endpoint.GetListAsync<TResult>(
  TResult template, 
  Action<ListOptions<IListModifier>> options = null, 
  CancellationToken cancellationToken = default
);

REST-Equivalent

No exact equivalent available because IPagedAsyncEnumerable<TResult> carries out paging in the background and further entries are loaded if necessary.

GET /apiv2/servicedmcore/CoreIdentity
?fields=readonly_display_name,ci_given_name,ci_family_name

Example-Code

public async Task GetCoreIdentityList()
{
	var api = GetService<IApiV2Client>();
	var endpoint = api.DmcoreService.Servicedmcore.CoreIdentity;
	var items = await endpoint.GetListAsync(new
	{
		ReadonlyDisplayName = string.Empty,
		CiGivenName = default(AccessDeniedHandler<string>),
		CiFamilyName = default(AccessDeniedHandler<string>)
	}).ToArray();
}

Read list of objects via template object with property chains

The property names of the template object are used as the property filter. Queries for properties which are not valid as a property (e.g. names with spaces) are not possible with this method.

SDK-Method

IPagedAsyncEnumerable<TResult> IApiV2Endpoint.GetListAsync<TResult>(
  TResult template, 
  Action<ListOptions<IListModifier>> options = null, 
  CancellationToken cancellationToken = default
);

REST-Equivalent

No exact equivalent available because IPagedAsyncEnumerable<TResult> carries out paging in the background and further entries are loaded if necessary.

GET /apiv2/servicedmcore/CoreIdentity
?fields=readonly_display_name,ci_given_name,ci_family_name,core_identity_type.id

Example-Code

public async Task GetCoreIdentityList()
{
	var api = GetService<IApiV2Client>();
	var endpoint = api.DmcoreService.Servicedmcore.CoreIdentity;
	var items = await endpoint.GetListAsync(new
	{
		CoreIdentityType = new
		{
			Id = default(AccessDeniedHandler<uint>)
		},
		ReadonlyDisplayName = string.Empty,
		CiGivenName = default(AccessDeniedHandler<string>),
		CiFamilyName = default(AccessDeniedHandler<string>)
	}).ToArray();
}

List of objects with filters

SDK-Method

IPagedAsyncEnumerable<TResult> IApiV2Endpoint.GetListAsync<TResult>(
  TResult template, 
  Action<ListOptions<IListModifier>> options = null, 
  CancellationToken cancellationToken = default
);

REST-Equivalent

No exact equivalent available because IPagedAsyncEnumerable<TResult> carries out paging in the background and further entries are loaded if necessary.

GET /apiv2/servicedmcore/CoreIdentity
?fields=readonly_display_name,ci_given_name,ci_family_name,core_identity_type.id
&filter=ci_zip_code eq 5000

Example-Code

public async Task GetCoreIdentityList()
{
	var api = GetService<IApiV2Client>();
	var endpoint = api.DmcoreService.Servicedmcore.CoreIdentity;
	var items = await endpoint.GetListAsync(new
	{
		ReadonlyDisplayName = string.Empty,
		CiGivenName = default(AccessDeniedHandler<string>),
		CiFamilyName = default(AccessDeniedHandler<string>)
	},
	o =>
	{
		o.AddModifier(
			new PropertyFilter
			{
				FilterType = FilterType.Equals,
				PropertyName = "ci_zip_code",
				Value = "5000"
			}
		);
	}).ToArray();
}

  • No labels