Skip to content

Latest commit

 

History

History
104 lines (86 loc) · 6.4 KB

misc.md

File metadata and controls

104 lines (86 loc) · 6.4 KB

Store, users & logs

Apify Store: client.store()

Browse public Actors in the Apify Store. client.store() returns a StoreCollectionClient.

Method Description
list(StoreListOptions) A page of Store Actors. Completes with PaginationList<ActorStoreListItem>.
iterate(StoreListOptions, Long chunkSize) A lazy Flow.Publisher<ActorStoreListItem> over all matches, fetching pages on demand. The options' limit caps the total number of rows read, which are the Actors yielded unless the API drops entries after counting them (null/unset or non-positive = all); chunkSize is the per-request page size (null = server default).

StoreListOptions fields: offset (number of Actors to skip), limit (maximum number of Actors to return), search (full-text search query), sortBy (the sort field, e.g. popularity, newest), category (filter Actors by category), username (filter Actors by owner username), pricingModel (filter by pricing model: FREE, PRICE_PER_DATASET_ITEM, PAY_PER_EVENT; the deprecated rental model FLAT_PRICE_PER_MONTH is no longer listed), includeUnrunnableActors (include Actors the current user cannot run), allowsAgenticUsers (only Actors that allow agentic users), responseFormat (the response shape: full or agent).

// Publishers.collect() drains the whole publisher; fine here since `limit` already caps it.
// To stop early without fetching further pages, subscribe with your own Flow.Subscriber instead
// (request(1) at a time, cancel() once you have enough); see IterateStore.java in the examples.
List<ActorStoreListItem> items =
    Publishers.collect(client.store().iterate(new StoreListOptions().search("crawler").limit(20L), 10L))
        .join();
items.forEach(item -> System.out.println(item.getUsername() + "/" + item.getName()));

ActorStoreListItem fields: getId(), getName(), getUsername(), getTitle(), getDescription(), getStats() (ActorStats; see Actors), getCurrentPricingInfo() (PricingInfo: getPricingModel()), getPictureUrl(), getUserPictureUrl(), getUrl(), getReadmeSummary(). Any field not covered by a typed getter is still available via the inherited getExtra() (see the docs index).

Users: client.me() / client.user(id)

Method Description
get() Fetch the user. Completes with Optional<User> (public profile, plus private account details for me() or when a full-permission token of that user, or one that impersonates it, is used).
monthlyUsage() / monthlyUsage(String date) The user's monthly usage. date (any day within the target month, formatted YYYY-MM-DD) reports that month; null/empty reports the current month. Completes with JsonNode.
limits() The user's account and usage limits. Completes with JsonNode.
updateLimits(Object) Update the user's account and usage limits. Completes with no value (CompletableFuture<Void>).

The usage/limits methods work on me() and on user(id) (/v2/users/{userId}/usage/monthly and /v2/users/{userId}/limits), subject to what the API token may access.

Optional<User> me = client.me().get().join();
me.ifPresent(
    u -> {
      System.out.println("Account: " + u.getId());
      // email/plan/proxy/... are private fields: see "Which fields are set" below.
      System.out.println("Email: " + u.getEmail());
    });
JsonNode usage = client.me().monthlyUsage().join();

Which fields are set:

  • getUsername() is set, except for a proxy-password request (below), and getProfile() may be absent.
  • The private fields (listed below, including getId()) are set for me(), and for user(id) only when the request uses a full-permission API token of that user or a token that impersonates it.
  • getPlan(), getEmail(), and getProfile() are omitted when me() is requested from an Actor run.
  • A request authenticated with an Apify Proxy password (PROXY_PASSWORD or ACTOR_RUN_PROXY_PASSWORD) gets reduced data on both endpoints: only getPlan() (with just getAvailableProxyGroups()), getEffectivePlatformFeatures(), and getIsPaying() are set, and getId() and getUsername() are null.

User fields: getUsername(), getProfile() (UserProfile: getBio(), getReadme(), getName(), getPictureUrl(), getGithubUsername(), getWebsiteUrl(), getTwitterUsername(), all nullable). Private fields: getId(), getEmail(), getProxy() (UserProxy: getPassword(), getGroups() as List<ProxyGroup>, each with getName()/getDescription()/getAvailableCount() as Long), getPlan() (UserPlan: getId(), getDescription(), getIsEnabled(), getMonthlyBasePriceUsd()/getMonthlyUsageCreditsUsd()/getUsageDiscountPercent()/ getMaxMonthlyUsageUsd()/getMaxActorMemoryGbytes()/getMaxMonthlyActorComputeUnits()/ getMaxMonthlyResidentialProxyGbytes()/getMaxMonthlyProxySerps()/ getMaxMonthlyExternalDataTransferGbytes() as Double, getEnabledPlatformFeatures() as List<String>, getMaxActorCount()/getMaxActorTaskCount()/getDataRetentionDays()/ getTeamAccountSeatCount() as Long, getAvailableProxyGroups() as JsonNode, getSupportLevel(), getAvailableAddOns() as List<JsonNode>), getEffectivePlatformFeatures() (JsonNode), getCreatedAt() (Instant), getIsPaying() (Boolean). Plus getExtra(), a Map<String, Object> carrying any account field not modeled directly.

Logs: client.log(id)

Access a build's or run's log directly, or via client.run(id).log() / client.build(id).log().

Method Description
get() / get(LogOptions) The whole log as text. Completes with Optional<String> when addressed by an explicit id (client.log(id)); on run.log()/build.log() (no log id of its own), a 404 is ambiguous and throws NotFoundError instead; see Fetching single resources.
getAsBytes() / getAsBytes(LogOptions) As get(), but completes with Optional<byte[]> (the raw bytes, not decoded as text). Same 404 handling as get().
stream() / stream(LogOptions) A live InputStream over the log (for redirection). Completes with InputStream; throws on any error response, including a 404.

LogOptions fields: raw(Boolean), download(Boolean).

Optional<String> log = client.log("RUN_OR_BUILD_ID").get().join();
log.ifPresent(System.out::println);