Skip to content

Add the usage of "global HTTP batch endpoints" to the Developer Documentation? #2106

Open

Description

@kumamidori

I'd like to send a PR if I am allowed to add the usage of "global HTTP batch endpoints" to the Developer Documentation.

On the other hand, I was concerned that not all APIs allow Batch Request, and that it is not a primary way of use.
Is it necessary? Please give me your opinion.

Example:

$client = new Client();
$scopes = [
    PagespeedInsights::OPENID,
];
$client->setScopes($scopes);

$url = 'https://foo.bar.dummy.xxx.com';
$client->setDefer(true);
$client->setDeveloperKey('your-key-dummy');

$batch = new Batch($psDeferClient, false, null, 'batch/pagespeedonline/v1');

/** @var \GuzzleHttp\Psr7\Request $request */
$request = $pageSpeedDefer->pagespeedapi->runpagespeed($url);
$batch->add($request, 'foo');

$responses = $batch->execute();
foreach ($responses as $response) {
    /** @var PagespeedApiPagespeedResponseV5 $response */
    var_dump($response->getId());
}

Activity

  1. changed the title [-]add the usage of "global HTTP batch endpoints" to the Developer Documentation?[/-] on Jul 28, 2021
  2. allinfoservice commented on Jul 29, 2021

    @allinfoservice

    @kumamidori do you mean your PR resolve an issue about batch processing? I try to add multiple events in Google Calendar and i receive error 404 on $batch->execute();

  3. kumamidori commented on Jul 30, 2021

    @kumamidori
    ContributorAuthor

    @allinfoservice It worked for me:

    $client = new Client();
    $client->setScopes(\Google\Service\Calendar::CALENDAR_READONLY);
    $client->setDefer(true);
    $client->setAuthConfig('/path/to/service/account/json');
    
    $batch = new Batch($client, false, null, 'batch/calendar/v3');
    $calendar = new \Google\Service\Calendar($client);
    $calendarId = 'japanese__ja@holiday.calendar.google.com';
    $request = $calendar->events->listEvents($calendarId, []);
    $batch->add($request, 'foo');
    $responses = $batch->execute();

    ref. #2052 (comment)

  4. allinfoservice commented on Jul 31, 2021

    @allinfoservice

    Excellent @kumamidori that works perfectly !

  5. added
    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.
    and removed
    triage meI really want to be triaged.
    🚨This issue needs some love.
    on Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions