Giter VIP home page Giter VIP logo

apisamples's Introduction

APISamples

This is a repository of code samples for the Associated Press APIs.

You will need to sign up for an API key before you can use any of the code in this repository.

#AP Content API

The full developer's guide can be found here.

##Basic Search

Basic search can be achieved using the following HTTP GET call:

http://api.ap.org/v2/search/{mediatype}?apikey={apikey}&q={searchterms}

mediatype can be photo, video, or graphic depending on the media type you are looking for. apikey is your API key and q is your search terms. As an example:

http://api.ap.org/v2/search/photo?apikey=your_api_key&q=computer

This returns photos about the search term "computer."

###Payload Format Support

The API returns XML (Atom 1.0) by default, but it can return JSON by applying accept:application/json in the header and JSONP by passing a callback HTTP GET parameter. Here is an example snippet in Python requesting for a JSON payload:

import requests

apikey = 'my_api_key'
keyword_search = 'star wars'

payload = requests.get('http://api.ap.org/v2/search/photo',
                       headers={'accept': 'application/json'},
                       params={'apikey': apikey, 'q': keyword_search})

apisamples's People

Contributors

associatedpressapi avatar carmenapuccio avatar ctsenthil avatar dalegaspi avatar davidfox-ap avatar jyoungap avatar primaryobjects avatar scohen2002 avatar srogouski avatar vzielinska avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apisamples's Issues

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.