Buscar Datos

Prevención de la violencia armada, leyes sobre el control de armas de fuego y el comercio de armas pequeñas:

Introduction to GunPolicy.org Data Page APIs

GunPolicy.org publishes evidence-based, fully referenced data, tables and charts to compare the effects of armed violence and gun laws across more than 350 jurisdictions world-wide. Visitors are welcome to use any information from this web site, providing they acknowledge its source on each page as 'Data from GunPolicy.org'.

To facilitate this, we encourage eligible organisations with Application Programming Interface (API) expertise to download our data at no charge, then to republish it with their own branding, but always with a visible credit to GunPolicy.org. The documentation below offers automated API access to the data we use to generate each country page (see, for example Switzerland), information categories, glossaries, plus more than 200,000 user-configurable charts and tables.

To access these APIs you will need a unique client_id and a secret key. To obtain your login, send the following details  to Esta dirección de correo electrónico está siendo protegida contra los robots de spam. Necesita tener JavaScript habilitado para poder verlo.:

  • Name
  • Position
  • Organisation
  • Address
  • City, Country and State
  • Web Site
  • E-mail
  • Describe where and how you intend to publish data copied from GunPolicy.org
  • Agree in your E-mail to credit each page of data or your summary of credits with the tag line 'Data from GunPolicy.org'


Your details are covered by our Privacy Policy and will be used only to verify the existence and good faith of applicants for an API login. Once you have API access to our site, follow the instructions below. To provide feedback, to discuss issues or to make suggestions, reach us at Esta dirección de correo electrónico está siendo protegida contra los robots de spam. Necesita tener JavaScript habilitado para poder verlo..

We look forward to seeing many creative and useful examples of GunPolicy.org data being re-published for the benefit of all audiences.

GunPolicy.org Data Page API Collection

List of Available GPO Data Page APIs. Click the corresponding link for details:

GET / Get Locations

Request URL: https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&resource=getlocations&format=raw

Description: This API lists all the location IDs and names that are used in the GunPolicy DataPage system. You will need a location ID to access some subsequent APIs below. For example if you need to pull the data for the country Australia, then you need the location ID of Australia. Find your desired location ID using this API:

Input Variables: none

Request Parameters:

option com_api
app gpodatapage
clientid 99 (YOUR UNIQUE CLIENT_ID)
key 9d1b7e0191 (YOUR SECRET KEY)
format raw
resource getlocations

Example:

 
Example RequestGet locations
curl --request GET \
  --url 'https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&format=raw&resource=getlocations'
							
Example Response200 OK
{
  "locations": [
    {
      "id": "1",
      "location_id": "1",
      "name": "Afghanistan",
      "location": "Afghanistan",
      "type": "country"
    },
    {
      "id": "3",
      "location_id": "3",
      "name": "Albania",
      "location": "Albania",
      "type": "country"
    },
    ...    
{ "id": "206", "location_id": "206", "name": "Zimbabwe", "location": "Zimbabwe", "type": "country" } ] }

GET / Get Top Categories

Request URL: https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&resource=gettopcategories&format=raw

Description: GunPolicy DataPage provides data across a number of categories. With this API, you'll receive Top Level Categories, their alias names and details. These aliases will be needed in other APIs. Gun Numbers, Death & Injury, etc., are examples of top level categories.

Input Variables: none

Request Parameters:

option com_api
app gpodatapage
clientid 99 (YOUR UNIQUE CLIENT_ID)
key 9d1b7e0191 (YOUR SECRET KEY)
format raw
resource gettopcategories

Example:

 
Example RequestGet Top Categories
curl --request GET \
  --url 'https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&format=raw&resource=gettopcategories'						
Example Response200 OK
{
  "result": [
    {
      "id": "1",
      "column_title": "Gun Numbers",
      "column_alias": "gun_numbers"
    },
    {
      "id": "2",
      "column_title": "Death and Injury",
      "column_alias": "gun_death_and_injury"
    },
    ...
    {
      "id": "222",
      "column_title": "Country Profile",
      "column_alias": "country_profile"
    }
  ]
}

 

GET / Get DP Categories

Request URL: https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&format=raw&resource=getdpcategories

Description: This API will list all the available category names and their subcategories, alias names & other details. The category alias names will be needed later to get the actual data of these categories, and citations and glossary information from other APIs.

Input Variables: Category Alias name and location_id

Request Parameters:

option com_api
app gpodatapage
clientid 99 (YOUR UNIQUE CLIENT_ID)
key 9d1b7e0191 (YOUR SECRET KEY)
format raw
resource getdpcategories

Example:

 
Example RequestGet dp categories
curl --request GET \
  --url 'https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&format=raw&resource=getdpcategories'						
Example Response200 OK
{
  "result": [
    {
      "title": "Gun Numbers",
      "alias": "gun_numbers",
      "subcategories": [
        {
          "title": "Civilian Guns",
          "alias": "civilian_guns",
          "parent_category": "gun_numbers",
          "subcategies": [
            {
              "title": "Number of Privately Owned Firearms",
              "alias": "number_of_privately_owned_firearms",
              "parent_category": "civilian_guns"
            },
            {
              "title": "Rate of Civilian Firearm Possession per 100 Population",
              "alias": "rate_of_civilian_firearm_possession",
              "parent_category": "civilian_guns"
            },
            ...
            {
              "title": "Number of Households with Firearms",
              "alias": "number_of_households_with_firearms",
              "parent_category": "civilian_guns"
            }
          ]
        },
        {
          "title": "Government Guns",
          "alias": "government_guns",
          "parent_category": "gun_numbers",
          "subcategies": [
            {
              "title": "Number of Military Firearms",
              "alias": "military_firearms",
              "parent_category": "government_guns"
            },
            {
              "title": "Routine Arming of Police",
              "alias": "police_use_of_firearms",
              "parent_category": "government_guns"
            },
            {
              "title": "Number of Law Enforcement Firearms",
              "alias": "law_enforcement_firearms",
              "parent_category": "government_guns"
            }
          ]
        }
      ]
    },
... { "title": "Country Profile", "alias": "country_profile", "subcategories": [ { "title": "Conflict Profile", "alias": "conflict_profile", "parent_category": "country_profile", "subcategies": [] }, { "title": "Global Peace Index", "alias": "global_peace_index", "parent_category": "country_profile", "subcategies": [] } ] } ] }

 

GET / Get Category Data

Request URL https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&resource=getcategorydata&category=number_of_homicides_any_method&location_id=10&format=raw

Description: This API will fetch the actual Category data for a specific country or location. To get the citations there are another API.

Input Variables: Category Alias and location_id

Request Parameters:

option com_api
app gpodatapage
clientid 99 (YOUR UNIQUE CLIENT_ID)
key 9d1b7e0191 (YOUR SECRET KEY)
format raw
resource getcategorydata
category number_of_homicides_any_method
location_id 10

Example:

 
Example RequestGet Category Data
curl --request GET \
  --url 'https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&format=raw&resource=getcategorydata&category=number_of_homicides_any_method&location_id=10'					
Example Response200 OK
{
  "result": {
    "id": "15",
    "location_id": "10",
    "location": "Australia",
    "columnValue": "2016: 244{q9177}; 2015: 265; 2014: 235; 2013: 227; 2012: 285{q9177} {q12091} {q8901}; 2011: 243{q9177} {q7379} {q12091} {q8901} {q6225} {q9635}; 2010: 258{q9177} {q7379} {q6476} {q8365} {q8901} {q6225}; 2009: 272; 2008: 251{q9177} {q7379} {q6476} {q8365} {q8901} {q6225}; 2007: 216; 2006: 256; 2005: 199; 2004: 164; 2003: 278{q7379} {q6476} {q8365} {q8901} {q6225}; 2002: 291; 2001: 300{q6476} {q8365} {q8901} {q6225}; 2000: 340{q8365} {q8901} {q6225}; 1999: 341{q8365} {q6225}; 1998: 312; 1997: 319; 1996: 358; 1995: 342; 1994: 342{q8365}; 1993: 360; 1992: 331; 1991: 351; 1990: 331;",
    "columnPreamble": "In #, annual homicides by any means total ~"
  }
}

 

GET / Get Citations by Category

Request URL: https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&resource=getcitationsbycategory&category=number_of_homicides_any_method&location_id=10&format=raw

Description: This API will list all of the citations data for a specific Category and location. Citations in our system are like the references of the displayed data.

Input Variables: Category Alias and location_id

Request Parameters:

option com_api
app gpodatapage
clientid 99 (YOUR UNIQUE CLIENT_ID)
key 9d1b7e0191 (YOUR SECRET KEY)
format raw
resource getcitationsbycategory
category number_of_homicides_any_method
location_id 10

Example:

 
Example RequestGet Citations by location id and category_name
curl --request GET \
  --url 'https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&resource=getcitationsbycategory&category=number_of_homicides_any_method&location_id=10%20&format=raw'					
Example Response200 OK
{
  "result": {
    "categoryValue": "2016: 244{q9177}; 2015: 265; 2014: 235; 2013: 227; 2012: 285{q9177} {q12091} {q8901}; 2011: 243{q9177} {q7379} {q12091} {q8901} {q6225} {q9635}; 2010: 258{q9177} {q7379} {q6476} {q8365} {q8901} {q6225}; 2009: 272; 2008: 251{q9177} {q7379} {q6476} {q8365} {q8901} {q6225}; 2007: 216; 2006: 256; 2005: 199; 2004: 164; 2003: 278{q7379} {q6476} {q8365} {q8901} {q6225}; 2002: 291; 2001: 300{q6476} {q8365} {q8901} {q6225}; 2000: 340{q8365} {q8901} {q6225}; 1999: 341{q8365} {q6225}; 1998: 312; 1997: 319; 1996: 358; 1995: 342; 1994: 342{q8365}; 1993: 360; 1992: 331; 1991: 351; 1990: 331;",
    "locaton_id": "10 Copy",
    "category_alias": "number_of_homicides_any_method",
    "citations": [
      [
        {
          "id": "9177",
          "title": "Underlying Cause of Death, All Causes, Year of Occurrence, Australia, 2007-2016 - Assault",
          "source": "Causes of Death, Australia, 2016",
          "content": "Chapter XX External causes of morbidity and mortality\n\nAssault (X85-Y09){q6107}\n\nYear: Number of Deaths\n\n2016: 244\n2015: 265\n2014: 235\n2013: 227\n2012: 285\n2011: 243\n2010: 258\n2009: 272\n2008: 251\n2007: 216\n2006: 256\n2005: 199\n2004: 164\n\nAssault by handgun discharge (X93){q6107}\n\nYear: Number of Deaths\n\n2016: 5\n2015: 1\n2014: 4\n2013: 3\n2012: 4\n2011: 6\n2010: 6\n2009: 9\n2008: 7\n2007: 1\n2006: 14\n2005: 4\n2004: 2\n\nAssault by rifle, shotgun and larger firearm discharge (X94){q6107}\n\nYear: Number of Deaths\n\n2016: 21\n2015: 13\n2014: 19\n2013: 11\n2012: 14\n2011: 17\n2010: 22\n2009: 18\n2008: 11\n2007: 14\n2006: 15\n2005: 10\n2004: 5\n\nAssault by other and unspecified firearm discharge (X95){q6107}\n\nYear: Number of Deaths\n\n2016: 16\n2015: 13\n2014: 8\n2013: 21\n2012: 24\n2011: 9\n2010: 11\n2009: 10\n2008: 9\n2007: 11\n2006: 12\n2005: 5\n2004: 10\n\nAll causes of death data from 2006 onward are subject to a revisions process - once data for a reference year are 'final', they are no longer revised. Affected data in this table are:  2006-2012 (final), 2013 (revised), 2014-2015 (preliminary).  See Explanatory Notes 52-55 and A More Timely Annual Collection: Changes to ABS Processes (Technical Note) in this publication.  See also Causes of Death Revisions, 2012 and 2013 (Technical Note) in Causes of Death, Australia, 2014 (cat. no. 3303.0). \n\nTotal, firearm discharge, assault (X93-X95){q6107}\n\nYear: Number of Deaths\n\n2016: 42\n2015: 27\n2014: 31\n2013: 35\n2012: 42\n2011: 32\n2010: 39\n2009: 37\n2008: 27\n2007: 26\n2006: 41\n2005: 19\n2004: 17\n\n[Editor's Note: Total of gun deaths from assault calculated by GunPolicy.org]",
          "page": "",
          "city": "Canberra",
          "publisher": "Australian Bureau of Statistics",
          "full_url": "/firearms/citation/quotes/9177"
        }
      ],
      [
        {
          "id": "9177",
          "title": "Underlying Cause of Death, All Causes, Year of Occurrence, Australia, 2007-2016 - Assault",
          "source": "Causes of Death, Australia, 2016",
          "content": "Chapter XX External causes of morbidity and mortality\n\nAssault (X85-Y09){q6107}\n\nYear: Number of Deaths\n\n2016: 244\n2015: 265\n2014: 235\n2013: 227\n2012: 285\n2011: 243\n2010: 258\n2009: 272\n2008: 251\n2007: 216\n2006: 256\n2005: 199\n2004: 164\n\nAssault by handgun discharge (X93){q6107}\n\nYear: Number of Deaths\n\n2016: 5\n2015: 1\n2014: 4\n2013: 3\n2012: 4\n2011: 6\n2010: 6\n2009: 9\n2008: 7\n2007: 1\n2006: 14\n2005: 4\n2004: 2\n\nAssault by rifle, shotgun and larger firearm discharge (X94){q6107}\n\nYear: Number of Deaths\n\n2016: 21\n2015: 13\n2014: 19\n2013: 11\n2012: 14\n2011: 17\n2010: 22\n2009: 18\n2008: 11\n2007: 14\n2006: 15\n2005: 10\n2004: 5\n\nAssault by other and unspecified firearm discharge (X95){q6107}\n\nYear: Number of Deaths\n\n2016: 16\n2015: 13\n2014: 8\n2013: 21\n2012: 24\n2011: 9\n2010: 11\n2009: 10\n2008: 9\n2007: 11\n2006: 12\n2005: 5\n2004: 10\n\nAll causes of death data from 2006 onward are subject to a revisions process - once data for a reference year are 'final', they are no longer revised. Affected data in this table are:  2006-2012 (final), 2013 (revised), 2014-2015 (preliminary).  See Explanatory Notes 52-55 and A More Timely Annual Collection: Changes to ABS Processes (Technical Note) in this publication.  See also Causes of Death Revisions, 2012 and 2013 (Technical Note) in Causes of Death, Australia, 2014 (cat. no. 3303.0). \n\nTotal, firearm discharge, assault (X93-X95){q6107}\n\nYear: Number of Deaths\n\n2016: 42\n2015: 27\n2014: 31\n2013: 35\n2012: 42\n2011: 32\n2010: 39\n2009: 37\n2008: 27\n2007: 26\n2006: 41\n2005: 19\n2004: 17\n\n[Editor's Note: Total of gun deaths from assault calculated by GunPolicy.org]",
          "page": "",
          "city": "Canberra",
          "publisher": "Australian Bureau of Statistics",
          "full_url": "/firearms/citation/quotes/9177"
        }
      ],
... ] } }

 

GET / Get Glossary Info

Request URL: https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&resource=getglossarydata&category=number_of_homicides_any_method&format=raw

Description:This API will show the definition and description of a Category. If you need more details about what a Category name or alias means, then this API will come into handy.

Input Variables: Category Alias and location_id

Request Parameters:

option com_api
app gpodatapage
clientid 99 (YOUR UNIQUE CLIENT_ID)
key 9d1b7e0191 (YOUR SECRET KEY)
format raw
resource getglossarydata
category number_of_homicides_any_method

Example:

 
Example RequestGet Glossary Info
curl --request GET \
  --url 'https://www.gunpolicy.org/index.php?option=com_api&app=gpodatapage&clientid=99&key=9d1b7e0191&resource=getglossarydata&category=number_of_homicides_any_method&format=raw'
Example Response200 OK
{
  "result": {
    "id": "17",
    "column_alias": "number_of_homicides_any_method",
    "column_title": "Homicides (any method)",
    "title": "Number of Homicides (any method)",
    "subtitle": "Definition and Selection Criteria",
    "content": "The reported, or estimated annual total of completed, intentional homicides committed by any means, in years descending.\r\n\r\nWhere a jurisdiction's published count of 'annual homicide' includes cases of attempted (uncompleted) homicide, these figures have been disaggregated wherever possible.\r\n\r\nIn the United States, this category is confused by inaccurate and conflicting data published, suppressed or labelled as unreliable by the Centers for Disease Control and Prevention (CDC) and the Federal Bureau of Investigation (FBI). Suppression can result in zero values where in fact homicides did occur.\r\n\r\nIncomplete classification by local agencies can also result in a significant proportion of events being categorised as 'unknown cause' or similar.\r\n\r\nBefore quoting these datasets, please follow the citation links for a description of the considerable differences between them and the reasons for data suppression.",
    "modified": "2016-05-10 22:35:29",
    "published": "1",
    "region_aggregation_type": "summation"
  }
}

ENDS