JavaJava V4 Objects API Reference for Realtime Apps

This page describes the new Objects v2. To upgrade from Objects v1, refer to the migration guide.

Objects provides easy-to-use, serverless storage for user and channel data you need to build innovative, reliable, scalable applications. Use Objects to easily store metadata about your application users and channels, and their membership associations, without the need to stand up your own databases.

PubNub also triggers events when object data is set or removed from the database. Clients can receive these events in realtime and update their front-end application accordingly.

Returns a paginated list of UUID Metadata objects, optionally including the custom data object for each.

To Get All UUID Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterString?OptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned.
    The filter language is defined here.
    sortList<PNSortKey>OptionalList of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest totalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
pubnub.getAllUUIDMetadata()
    .limit(20)
    .sort(SortKey.asc(SortKey.Key.ID), SortKey.desc(SortKey.Key.UPDATED))
    .includeTotalCount(true)
    .includeCustom(true)
    .async(new PNCallback<PNGetAllUUIDMetadataResult>() {
        @Override
        public void onResponse(@Nullable final PNGetAllUUIDMetadataResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            }
            else {
                //handle result
            }
        }
    });
public class PNGetAllUUIDMetadataResult extends EntityArrayEnvelope<PNUUIDMetadata> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNUUIDMetadata> data;
    PNPage nextPage() {
        return PNPage.next(next);
    }
    PNPage previousPage() {
        return PNPage.previous(prev);
    }
}

public class PNUUIDMetadata extends PNObject {
    String id;
    Object custom;
    String updated;
    String eTag;
    String name;
    String email;
    String externalId;
    String profileUrl;
}

Returns metadata for the specified UUID, optionally including the custom data object for each.

To Get UUID Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    uuidStringOptionalpubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
pubnub.getUUIDMetadata().async(new PNCallback<PNGetUUIDMetadataResult>() {
    @Override
    public void onResponse(@Nullable final PNGetUUIDMetadataResult result, @NotNull final PNStatus status) {
        if (status.isError()) {
            //handle error
        }
        else {
            //handle result
        }
    }
});
public class PNGetUUIDMetadataResult extends EntityEnvelope<PNUUIDMetadata> {
    int status;
    PNUUIDMetadata data;
}

public class PNUUIDMetadata extends PNObject {
    String id;
    Object custom;
    String updated;
    String eTag;
    String name;
    String email;
    String externalId;
    String profileUrl;
}

Set metadata for a UUID in the database, optionally including the custom data object for each.

To Set UUID Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    uuidStringOptionalpubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
    nameStringOptionalDisplay name for the user, up to 200 characters.
    externalIdStringOptionalUser's identifier in an external system.
    profileUrlStringOptionalThe URL of the user's profile picture.
    emailStringOptionalThe user's email address.
    Maximum 80 characters.
    customAnyOptionalAny object of key-value pairs with supported data types.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
pubnub.setUUIDMetadata()
    .name("Foo")
    .profileUrl("http://example.com")
    .email("foo@example.com")
    .includeCustom(true)
    .async(new PNCallback<PNSetUUIDMetadataResult>() {
        @Override
        public void onResponse(@Nullable final PNSetUUIDMetadataResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            }
            else {
                //handle result
            }
        }
    });
public class PNSetUUIDMetadataResult extends EntityEnvelope<PNUUIDMetadata> {
    protected int status;
    protected PNUUIDMetadata data;
}

public class PNUUIDMetadata extends PNObject {
    String id;
    Object custom;
    String updated;
    String eTag;
    String name;
    String email;
    String externalId;
    String profileUrl;
}

Removes the metadata from a specified UUID.

To Remove UUID Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    uuidStringOptionalpubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
pubnub.removeUUIDMetadata()
    .async(new PNCallback<PNRemoveUUIDMetadataResult>() {
        @Override
        public void onResponse(@Nullable final PNRemoveUUIDMetadataResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            }
            else {
                //handle result
            }
        }
    });
public class PNRemoveUUIDMetadataResult extends EntityEnvelope<JsonElement> {
    int status;
    JsonElement data;
}

Returns a paginated list of Channel Metadata objects, optionally including the custom data object for each.

To Get All Channel Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortList<PNSortKey>OptionallistOf()List of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest totalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
pubnub.getAllChannelsMetadata()
    .async(new PNCallback<PNGetAllChannelsMetadataResult>() {
        @Override
        public void onResponse(@Nullable final PNGetAllChannelsMetadataResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    })
public class PNGetAllChannelsMetadataResult extends EntityArrayEnvelope<PNChannelMetadata> {
    int status;
    List<PNChannelMetadata> data;
    Integer totalCount;
    String next;
    String prev;
}


public class PNChannelMetadata extends PNObject {
    String id;
    Object custom;
    String updated;
    String eTag;
    String name;
    String description;
}

Returns metadata for the specified Channel, optionally including the custom data object for each.

To Get Channel Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelStringYesChannel name.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
pubnub.getChannelMetadata()
    .channel("myChannel")
    .async(new PNCallback<PNGetChannelMetadataResult>() {
        @Override
        public void onResponse(@Nullable final PNGetChannelMetadataResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNGetChannelMetadataResult extends EntityEnvelope<PNChannelMetadata> {
    protected int status;
    protected PNChannelMetadata data;
}

public class PNChannelMetadata extends PNObject {
    String id;
    Object custom;
    String updated;
    String eTag;
    String name;
    String description;
}

Set metadata for a Channel in the database, optionally including the custom data object for each.

To Set Channel Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelStringYesChannel name.
    nameStringOptionalName for the channel.
    descriptionStringOptionalDescription of a channel.
    customMap<String, Object>OptionalAny object of key-value pairs with supported data types.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
pubnub.setChannelMetadata()
    .channel("myChannel")
    .name("Some Name")
    .includeCustom(true)
    .async(new PNCallback<PNSetChannelMetadataResult>() {
        @Override
        public void onResponse(@Nullable final PNSetChannelMetadataResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNSetChannelMetadataResult extends EntityEnvelope<PNChannelMetadata> {
    protected int status;
    protected PNChannelMetadata data;
}

public class PNChannelMetadata extends PNObject {
    String id;
    Object custom;
    String updated;
    String eTag;
    String name;
    String description;
}

Removes the metadata from a specified channel.

To Remove Channel Metadata you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelStringYesChannel name.
pubnub.removeChannelMetadata()
    .channel("myChannel")
    .async(new PNCallback<PNRemoveChannelMetadataResult>() {
        @Override
        public void onResponse(@Nullable final PNRemoveChannelMetadataResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNRemoveChannelMetadataResult extends EntityEnvelope<JsonElement> {
    int status;
    protected JsonElement data;
}

The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.

To Get Memberships you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    uuidStringOptionalpubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionallistOf()List of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest totalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include custom object in the fetch response.
    includeChannelPNChannelDetailsLevelOptionalThe level of channel details to return in the membership. Possible values are PNChannelDetailsLevel.CHANNEL which includes basic channel information, and PNChannelDetailsLevel.CHANNEL_WITH_CUSTOM which also includes the custom object.
pubnub.getMemberships()
    .async(new PNCallback<PNGetMembershipsResult>() {
        @Override
        public void onResponse(@Nullable final PNGetMembershipsResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    })
public class PNGetMembershipsResult extends EntityArrayEnvelope<PNMembership> {
    protected Integer totalCount;
    protected String next;
    protected String prev;
    protected int status;
    protected List<PNMembership> data;
}

public class PNMembership {
    PNChannelMetadata channel;
    Object custom;
    String updated;
    String eTag;
}

Set channel memberships for a UUID.

To Set Memberships you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelMembershipsList<PNChannelMembership>YesCollection of PNChannelMembership to add to membership.
    uuidStringOptionalpubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalN/AThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionalN/AList of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest totalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
    includeChannelPNChannelDetailsLevelOptionalThe level of channel details to return in the membership. Possible values are PNChannelDetailsLevel.CHANNEL which includes basic channel information, and PNChannelDetailsLevel.CHANNEL_WITH_CUSTOM which also includes the custom object.
pubnub.setMemberships()
    .channelMemberships(Collections.singletonList(PNChannelMembership.channel("channelId")))
    .async(new PNCallback<PNSetMembershipResult>() {
        @Override
        public void onResponse(@Nullable final PNSetMembershipResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNSetMembershipResult extends EntityArrayEnvelope<PNMembership> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNMembership> data;
}

public class PNMembership {
    PNChannelMetadata channel;
    Object custom;
    String updated;
    String eTag;
}

Remove channel memberships for a UUID.

To Remove Memberships you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelMembershipsList<PNChannelMembership>YesCollection of PNChannelMembership to add to membership.
    uuidStringOptionalpubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionallistOf()List of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest totalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
    includeChannelPNChannelDetailsLevelOptionalThe level of channel details to return in the membership. Possible values are PNChannelDetailsLevel.CHANNEL which includes basic channel information, and PNChannelDetailsLevel.CHANNEL_WITH_CUSTOM which also includes the custom object.
pubnub.removeMemberships()
    .channelMemberships(Collections.singletonList(PNChannelMembership.channel("channelId")))
    .async(new PNCallback<PNRemoveMembershipResult>() {
        @Override
        public void onResponse(@Nullable final PNRemoveMembershipResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNRemoveMembershipResults extends EntityArrayEnvelope<PNMembership> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNMembership> data;
}

public class PNMembership {
    PNChannelMetadata channel;
    Object custom;
    String updated;
    String eTag;
}

Manage a user's channel memberships.

To Manage Memberships you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    uuidStringOptionalpubnub.configuration.uuidUnique UUID Metadata identifier. If not supplied, then UUID from configuration will be used.
    setCollection<PNChannelMembership>YesList of members PNChannelMembership to add to channel.
    removeCollection<PNChannelMembership>YesList of members PNChannelMembership to remove from channel.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionalN/AList of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest includeTotalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
    includeChannelPNChannelDetailsLevelOptionalThe level of UUID details to return. Possible values are PNChannelDetailsLevel.CHANNEL which includes basic UUID information, and PNChannelDetailsLevel.CHANNEL_WITH_CUSTOM which also includes the custom object.
pubnub.manageMemberships()
    .set(Collections.singletonList(PNChannelMembership.channel("channelIdToSet")))
    .remove(Collections.singletonList(PNChannelMembership.channel("channelIdToRemove")))
    .async(new PNCallback<PNManageMembershipResult>() {
        @Override
        public void onResponse(@Nullable final PNManageMembershipResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNManageMembershipResult extends EntityArrayEnvelope<PNMembership> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNMembership> data;
}

public class PNMembership {
    PNChannelMetadata channel;
    Object custom;
    String updated;
    String eTag;
}

The method returns a list of members in a channel. The list will include user metadata for members that have additional metadata stored in the database.

To Get Channel Members you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelStringYesChannel name.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionallistOf()List of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest includeTotalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
    includeUUIDPNUUIDDetailsLevelOptionalThe level of UUID details to return. Possible values are PNUUIDDetailsLevel.UUID which includes basic UUID information, and PNUUIDDetailsLevel.UUID_WITH_CUSTOM which also includes the custom object.
pubnub.getChannelMembers()
    .channel("channelId")
    .async(new PNCallback<PNGetChannelMembersResult>() {
        @Override
        public void onResponse(@Nullable final PNGetChannelMembersResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle response
            }
        }
    });
public class PNRemoveMembershipResults extends EntityArrayEnvelope<PNMembers> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNMembers> data;
}

public class PNMembers {
    PNUUIDMetadata uuid;
    Object custom;
    String updated;
    String eTag;
}

This method sets members in a channel.

To Set Channel Members you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelStringYesChannel name.
    uuidsCollection<PNUUID>YesList of members PNUUID to add to channel.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionalN/AList of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest includeTotalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
    includeUUIDPNUUIDDetailsLevelOptionalThe level of UUID details to return. Possible values are PNUUIDDetailsLevel.UUID which includes basic UUID information, and PNUUIDDetailsLevel.UUID_WITH_CUSTOM which also includes the custom object.
pubnub.setChannelMembers()
    .channel("channelId")
    .uuids(Collections.singletonList(PNUUID.uuid("uuid")))
    .async(new PNCallback<PNSetChannelMembersResult>() {
        @Override
        public void onResponse(@Nullable final PNSetChannelMembersResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNSetChannelMembersResult extends EntityArrayEnvelope<PNMembers> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNMembers> data;
}

public class PNMembers {
    PNUUIDMetadata uuid;
    Object custom;
    String updated;
    String eTag;
}

Remove members from a Channel.

To Remove Channel Members you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelStringYesChannel name.
    uuidsCollection<PNUUID>YesList of members PNUUID to remove from channel.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionalN/AList of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest includeTotalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
    includeUUIDPNUUIDDetailsLevelOptionalThe level of UUID details to return. Possible values are PNUUIDDetailsLevel.UUID which includes basic UUID information, and PNUUIDDetailsLevel.UUID_WITH_CUSTOM which also includes the custom object.
pubnub.removeChannelMembers()
    .channel("channelId")
    .uuids(Collections.singletonList(PNUUID.uuid("uuid")))
    .async(new PNCallback<PNRemoveChannelMembersResult>() {
        @Override
        public void onResponse(@Nullable final PNRemoveChannelMembersResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNRemoveChannelMembersResult extends EntityArrayEnvelope<PNMembers> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNMembers> data;
}

public class PNMembers {
    PNUUIDMetadata uuid;
    Object custom;
    String updated;
    String eTag;
}

The method Set and Remove channel memberships for a user.

To Manage Channel Members you can use the following method(s) in the Java V4 SDK:

  1. ParameterTypeRequiredDefaultsDescription
    channelStringYesChannel name.
    setCollection<PNUUID>YesList of members PNUUID to add to channel.
    removeCollection<PNUUID>YesList of members PNUUID to remove from channel.
    limitIntegerOptional100The maximum number of objects to retrieve at a time.
    pagePNPageOptionalThe paging object used for pagination.
    filterStringOptionalExpression used to filter the results. Only objects whose properties satisfy the given expression are returned. The filter language is defined here.
    sortPNSortKeyOptionalN/AList of properties to sort by.
    includeTotalCountBooleanOptionalfalseRequest includeTotalCount to be included in paginated response, which is omitted by default.
    includeCustomBooleanOptionalfalseWhether to include the custom object in the fetch response.
    includeUUIDPNUUIDDetailsLevelOptionalThe level of UUID details to return. Possible values are PNUUIDDetailsLevel.UUID which includes basic UUID information, and PNUUIDDetailsLevel.UUID_WITH_CUSTOM which also includes the custom object.
pubnub.manageChannelMembers()
    .channel("channelId")
    .set(Collections.singletonList(PNUUID.uuid("uuidToSet")))
    .remove(Collections.singletonList(PNUUID.uuid("uuidToRemove")))
    .async(new PNCallback<PNManageChannelMembersResult>() {
        @Override
        public void onResponse(@Nullable final PNManageChannelMembersResult result, @NotNull final PNStatus status) {
            if (status.isError()) {
                //handle error
            } else {
                //handle result
            }
        }
    });
public class PNManageChannelMembersResult extends EntityArrayEnvelope<PNMembers> {
    Integer totalCount;
    String next;
    String prev;
    int status;
    List<PNMembers> data;
}

public class PNMembers {
    PNUUIDMetadata uuid;
    Object custom;
    String updated;
    String eTag;
}

PNChannelMembership is a utility class that exposes two factory methods: channel(String channelId) constructs a channel membership, and channelWithCustom(String channelId, Map<String, Object> custom) constructs a channel membership with additional custom metadata.

public abstract class PNChannelMembership {
    public static class ChannelId {
        private String id;
    }

    private final ChannelId channel;

    public static PNChannelMembership channel(final String channelId) {
        return new JustChannel(new ChannelId(channelId));
    }

    public static PNChannelMembership channelWithCustom(final String channelId, final Map<String, Object> custom) {
        return new ChannelWithCustom(new ChannelId(channelId), new HashMap<>(custom));
    }

    public static class JustChannel extends PNChannelMembership {}

    public static class ChannelWithCustom extends PNChannelMembership {
        @JsonAdapter(CustomPayloadJsonInterceptor.class)
        private final Object custom;
    }
}

PNUUID is a utility class that exposes two factory methods: uuid(String uuid) constructs a UUID, and uuidWithCustom(String channelId, Map<String, Object> custom) constructs a UUID with additional custom metadata.

public abstract class PNUUID {
    public static class UUIDId {
        private String id;
    }

    private final UUIDId uuid;

    public static PNUUID uuid(final String uuid) {
        return new JustUUID(new UUIDId(uuid));
    }
    public static PNUUID uuidWithCustom(final String uuid, final Map<String, Object> custom) {
        return new UUIDWithCustom(new UUIDId(uuid), new HashMap<>(custom));
    }

    public static class JustUUID extends PNUUID {
    }

    public static class UUIDWithCustom extends PNUUID {
        private final Object custom;
    }
}

The filtering language for Objects is similar to the stream filtering language.

Note the following:

  • Date/time properties, such as updated, must be compared to valid date/time strings formatted according to ISO 8601.
  • Custom properties must have the same type as the value used in the expression; it is an error to compare a custom property of one type to a value of another type.
  • Objects that do not have the referenced custom property at all are excluded regardless of the operator or value used in the expression. The null value can be used to filter out objects that do or do not have the referenced custom property.
  • The LIKE operator supports wildcards denoted by the * character. A wildcard matches any sequence of arbitrary Unicode characters, including the empty sequence. The literal asterisk is matched when escaped using the backslash (\) character.
  • Values used with LIKE must be properly encoded just like any other string value. Thus, in order to escape an asterisk, the raw value must contain \\*.
  • The entire expression must be properly URL-encoded when used in the query string.

<expression>           ::= <and_expression> ( "||" <and_expression> )*
<and_expression>       ::= <binary_condition> ( "&&" <binary_condition> )*
<binary_condition>     ::= "!" <binary_condition> | "(" <expression> ")" | <relational_condition>
<relational_condition> ::= <property_path> <relational_operator> <value>
<property_path>        ::= <property_name> ( "." <property_name> )*
<property_name>        ::= <identifier> | "[" <string> "]"
<value>                ::= <string> | <number> | "true" | "false" | "null"

Tokens

<identifier>           ::=  <letter> | "$" | "_" ( <letter> | "$" | "_" | <digit> )*
<relational_operator>  ::= "==" | "!=" | "<=" | ">=" | "<" | ">" | "LIKE"
<string>               ::= <double_quote> ( "\" <double_quote> | "\" <special_char>
                            | "\" "u" <hex_digit> <hex_digit> <hex_digit> <hex_digit>
                            | <unicode_char> - <double_quote> - "\" )* <double_quote>
                            | "'" ( "\" "'" | "\" <special_char>
                            | "\" "u" <hex_digit> <hex_digit> <hex_digit> <hex_digit>
                            | <unicode_char> - "'" - "\" )* "'"
<number>               ::= ( "+" | "-" )? ( <digit> )* ( "." )? <digit> ( <digit> )* 
                            ( "e" | "E" ( "+" | "-" )? <digit> ( <digit> )* )?
<letter>               ::= Unicode Letter (category; any kind of letter from any language)
<digit>                ::= "0" .. "9"
<hex_digit>            ::= <digit> | "A" .. "F"
<double_quote>         ::= the " character
<unicode_char>         ::= any character in the Unicode range from U+0020 to U+10FFFF inclusive
<special_char>         ::= "\" | "/" | "b" | "f" | "n" | "r" | "t"

The following simple expression returns results whose custom property named public is equal to Boolean true.


custom.public == true

The following date/time comparison returns results that were modified on or after August 31st, 2019 (UTC):


updated >= "2019-08-31T00:00:00Z"

The following compound expression returns results that don't have a description, but do have a non-empty custom label or description property:


description == null && (custom.label != "" || custom.description != "")

The following wildcard expression returns results whose name starts with the letter X:


name LIKE 'X*'

The following escaped wildcard expression returns results whose name contains an asterisk:


name LIKE '*\\**'