POST format: use 'json' in the $options argument

Created on 12 December 2024, 12 days ago

Took me some trial and error to figure out that I have to use a 'json' parameter in my POST request to get Zoom API to accept the request.

For example:

\Drupal::service('zoomapi.client')->post('/webinars/12345/registrants', ['json' => ['first_name' => 'Foo', 'last_name' => 'Bar']]);

If you're running into "Bad Request" response, this might be your problem as well.

The error message was:

Client error: `POST resulted in a `400 Bad Request` response:
>?xml version="1.0" encoding="UTF-8" standalone="yes"?>>code>300>/code>>message>Request Body should be a valid JS (truncated...)

Posting for posterity, and I know you don't want to maintain documentation for the base rest client module, but may be good to include a blurb about this in the README.

✨ Feature request
Status

Active

Version

3.0

Component

Miscellaneous

Created by

πŸ‡ΊπŸ‡ΈUnited States AaronBauman Philadelphia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024