GoogleAPIsURLShortener.urlInsert()

Create a short URL from given long version

Usage

Hover over inputs/exits for more info.

var GoogleAPIsURLShortener = require('machinepack-googleapisurlshortener');


// Create a short URL from given long version

GoogleAPIsURLShortener.urlInsert({

longUrl: 'https://www.google.com',

analitics: {},

id: 'someUniqId',

kind: 'urlshortener#url',

status: 'SomeStatus',

created: '1605-11-05T00:00:00.000Z',

fields: 'analytics,created,id,kind,longUrl,status',

key: 'AIzaSyAYVDlaoVs_GZw9JNvSclRWH_PEMKII6tc',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// Invalid field parameter passed

invalidParameter: function () {

 

},

// Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

dailyLimitExceededUnreg: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

longUrl

'https://www.google.com'
analitics

id

id is the short URL that expands to the long URL you provided. If your request includes an auth token, then this URL will be unique. If not, then it might be reused from a previous request to shorten the same URL.

'someUniqId'
kind

https://developers.google.com/url-shortener/v1/url/insert

'urlshortener#url'
status

https://developers.google.com/url-shortener/v1/url/insert

'SomeStatus'
created

https://developers.google.com/url-shortener/v1/url/insert

'1605-11-05T00:00:00.000Z'
fields

Selector specifying which fields to include in a partial response

'analytics,created,id,kind,longUrl,status'
key

Your api key

'AIzaSyAYVDlaoVs_GZw9JNvSclRWH_PEMKII6tc'

Exits

error

An unexpected error occurred.

invalidParameter

Invalid field parameter passed

dailyLimitExceededUnreg

Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

success

OK.