Google-api-nodejs-client: How to set an user-agent?

Created on 28 Aug 2019  路  3Comments  路  Source: googleapis/google-api-nodejs-client

As far as I understand, there is a way implemented to set the user-agent.
But I didn't found any documentation/comment which explains how I add the user-agent.

https://github.com/googleapis/google-api-nodejs-client/issues/1468

question

Most helpful comment

friendly pump

All 3 comments

friendly pump

@oliverjessner I believe you should be able to do something along the lines of:

const {google} = require('googleapis');
google.options({
  userAgentDirectives: [{product: 'frog', version: '1.0', comment: 'jumps'}]
});
const blogger = google.blogger({
  version: 'v3',
  // All requests made with this service client will contain the
  // blogId query parameter unless overridden in individual API calls.
  params: {
    blogId: 3213900
  }
});

:point_up: global configuration options should be applied to each client.

Since we haven't heard anything I am going to close this and assume @bcoe sample above will work for your use case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lowagner picture lowagner  路  3Comments

dibeesh picture dibeesh  路  4Comments

leecheve picture leecheve  路  3Comments

ovaris picture ovaris  路  3Comments

JustinBeckwith picture JustinBeckwith  路  3Comments