Code Monkey home page Code Monkey logo

gettyimages-api_nodejs's Introduction

Getty Images API Node.js SDK


Code Climate

Prerequesites

Getting Started

Create the following system environment variables using your Getty Images Connect credentials:

  • ConnectSDK_ApiKey
  • ConnectSDK_ApiSecret
  • ConnectSDK_UserName
  • ConnectSDK_UserPassword

The SDK is available as an npm module. Install globally with:

$ npm install -g gettyimages-api

Or you may define the SDK as a dependency of your application by including it in a package.json file:

{ "dependencies" : {
    "connectsdk": "1.0.x"
    }
}

Examples

Search for one or more images:

var connectSdk = new ConnectSdk (
    process.env.ConnectSDK_ApiKey,
    process.env.ConnectSDK_ApiSecret,
    process.env.ConnectSDK_UserName,
    process.env.ConnectSDK_UserPassword)

var search = connectSdk
	.search()
	.images()
	.withPage(1)
	.withPageSize(1)
	.withPhrase('beach')

search.execute(function(err, response) {
	if (err) throw err
	console.log(JSON.stringify(response.images[0]))
})

Get detailed information for one or more images:

var connectSdk = new ConnectSdk (
    process.env.ConnectSDK_ApiKey,
    process.env.ConnectSDK_ApiSecret,
    process.env.ConnectSDK_UserName,
    process.env.ConnectSDK_UserPassword)

var images = connectSdk
	.images()
	.withId('200261415-001')

images.execute(function(err, response) {
	if (err) throw err
	console.log(JSON.stringify(response.images[0]))
})

Download an image:

var connectSdk = new ConnectSdk (
    process.env.ConnectSDK_ApiKey,
    process.env.ConnectSDK_ApiSecret,
    process.env.ConnectSDK_UserName,
    process.env.ConnectSDK_UserPassword)

var download = connectSdk
    .download()
    .withId('467073457')

download.execute(function(err, response) {
    if (err) throw err
    console.log(response.uri)
})

Get an access token for use with the Getty Images Connect API:

var connectSdk = new ConnectSdk (
    process.env.ConnectSDK_ApiKey,
    process.env.ConnectSDK_ApiSecret,
    process.env.ConnectSDK_UserName,
    process.env.ConnectSDK_UserPassword)

connectSdk.getAccessToken(function(err, response) {
    if (err) throw err
    console.log(response.access_token)
})

Help & Support

gettyimages-api_nodejs's People

Contributors

caseymacpherson avatar mapitman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.