Skip to content

Document passing body via client.request() (using query and headers['Content-Type']) #186

@karlhorky

Description

@karlhorky

Hi there, thanks for this library!

I'm just trying to pass a "Body" option active: true to a new thumbnail, which is mentioned in the API documentation for POST https://api.vimeo.com/videos/{video_id}/pictures (see below)

Screenshot 2023-07-29 at 18 57 30

The numbered comments in the code block below show all of the *non-working* things I've tried (I tried them one by one, on their own):

import { Vimeo } from '@vimeo/vimeo';

const client = new Vimeo(VIMEO_CLIENT_ID, VIMEO_CLIENT_SECRET, VIMEO_ACCESS_TOKEN);

client.request(
  {
    method: 'POST',
    // 1. Pass via query
    path: `/videos/${vimeoVideoId}/pictures?active=true`,

    // 2. Pass via `body` string
    body: JSON.stringify({ active: true }),

    // 3. Pass via `body` object
    body: { active: true },

    // 4. Pass via `query`
    query: { active: true },

    // 5. Pass via `params`
    params: { active: true },    
  },
  (error, response) => {
    if (error) {
      console.log('error', error);
    }

    console.log('response', response);
  },
);

I don't see the body documented anywhere... is there a way to do this with the client?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions