1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[82840],{63658:function(e,s,i){(window.__NEXT_P=window.__NEXT_P||[]).push(["/apis/dogs",function(){return i(97019)}])},97019:function(e,s,i){"use strict";i.r(s),i.d(s,{default:function(){return b}});var t=i(85893),a=i(67294),n=i(41664),r=i.n(n),l=i(10241),o=i(7636),d=i(15600),c=i(6055),h=i(96503),m=i(49152),p=i(67509);let x={curl:`curl -X GET "https://api.api-ninjas.com/v1/dogs?name=husky" \\ 2 -H "X-Api-Key: YOUR_API_KEY"`,python:`import requests 3 4name = 'husky' 5api_url = 'https://api.api-ninjas.com/v1/dogs?name={}'.format(name) 6response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) 7if response.status_code == requests.codes.ok: 8 print(response.text) 9else: 10 print("Error:", response.status_code, response.text)`,javascript:`var name = 'golden retriever' 11$.ajax({ 12 method: 'GET', 13 url: 'https://api.api-ninjas.com/v1/dogs?name=' + name, 14 headers: { 'X-Api-Key': 'YOUR_API_KEY'}, 15 contentType: 'application/json', 16 success: function(result) { 17 console.log(result); 18 }, 19 error: function ajaxError(jqXHR) { 20 console.error('Error: ', jqXHR.responseText); 21 } 22});`,nodejs:`const request = require('request'); 23var name = 'golden retriever'; 24request.get({ 25 url: 'https://api.api-ninjas.com/v1/dogs?name=' + name, 26 headers: { 27 'X-Api-Key': 'YOUR_API_KEY' 28 }, 29}, function(error, response, body) { 30 if(error) return console.error('Request failed:', error); 31 else if(response.statusCode != 200) return console.error('Error:', response.statusCode, body.toString('utf8')); 32 else console.log(body) 33});`,java:`import java.io.InputStream; 34import java.net.HttpURLConnection; 35import java.net.URL; 36 37import com.fasterxml.jackson.databind.ObjectMapper; 38 39URL url = new URL("https://api.api-ninjas.com/v1/dogs?name=golden retriever"); 40HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 41connection.setRequestProperty("accept", "application/json"); 42InputStream responseStream = connection.getInputStream(); 43ObjectMapper mapper = new ObjectMapper(); 44JsonNode root = mapper.readTree(responseStream); 45System.out.println(root.toString());`,swift:`let name = "golden retriever".addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed) 46let url = URL(string: "https://api.api-ninjas.com/v1/dogs?name="+name!)! 47var request = URLRequest(url: url) 48request.setValue("YOUR_API_KEY", forHTTPHeaderField: "X-Api-Key") 49let task = URLSession.shared.dataTask(with: request) {(data, response, error) in 50 guard let data = data else { return } 51 print(String(data: data, encoding: .utf8)!) 52} 53task.resume()`},u=[{name:"name",description:"The name of the dog breed."},{name:"image_link",description:"URL to an image of the breed."},{name:"good_with_children",description:"Compatibility rating with children (1-5, where 5 is best)."},{name:"good_with_other_dogs",description:"Compatibility rating with other dogs (1-5, where 5 is best)."},{name:"good_with_strangers",description:"Compatibility rating with strangers (1-5, where 5 is best)."},{name:"shedding",description:"How much hair the breed sheds (1-5, where 1 indicates no shedding and 5 indicates maximum shedding)."},{name:"grooming",description:"Grooming requirement rating (1-5, where 5 indicates highest maintenance)."},{name:"drooling",description:"Drooling tendency rating (1-5, where 5 indicates maximum drooling)."},{name:"coat_length",description:"Coat length rating (1-5)."},{name:"playfulness",description:"Playfulness rating (1-5, where 5 indicates highest playfulness)."},{name:"protectiveness",description:"How likely the breed is to alert strangers (1-5, where 1 indicates minimal alerting and 5 indicates maximum alerting)."},{name:"trainability",description:"How easy it is to train the breed (1-5, where 1 indicates very difficult to train and 5 indicates very easy to train)."},{name:"energy",description:"How much energy the breed has (1-5, where 1 indicates low energy and 5 indicates high energy)."},{name:"barking",description:"How vocal the breed is (1-5, where 1 indicates minimal barking and 5 indicates maximum barking)."},{name:"min_life_expectancy",description:"Minimum life expectancy in years."},{name:"max_life_expectancy",description:"Maximum life expectancy in years."},{name:"min_height_male",description:"Minimum height in inches for male dogs."},{name:"max_height_male",description:"Maximum height in inches for male dogs."},{name:"min_height_female",description:"Minimum height in inches for female dogs."},{name:"max_height_female",description:"Maximum height in inches for female dogs."},{name:"min_weight_male",description:"Minimum weight in pounds for male dogs."},{name:"max_weight_male",description:"Maximum weight in pounds for male dogs."},{name:"min_weight_female",description:"Minimum weight in pounds for female dogs."},{name:"max_weight_female",description:"Maximum weight in pounds for female dogs."}],g=e=>{let{show:s,onToggle:i}=e;return(0,t.jsxs)("div",{children:[(0,t.jsx)("button",{onClick:i,className:"btn btn-primary font-13 mb-2","aria-expanded":s,"aria-controls":"dogs-fields-table",style:{textDecoration:"none"},children:s?"Hide List of Response Fields â²":"Show All Response Fields â¼"}),(0,t.jsx)("div",{id:"dogs-fields-table",style:{maxHeight:s?void 0:0,overflow:"hidden",transition:"max-height 0.3s cubic-bezier(.4,0,.2,1)"},"aria-hidden":!s,children:s&&(0,t.jsx)("ul",{className:"list-group api-list mb-2 mt-2",children:u.map(e=>(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsx)("h5",{className:"my-1 text-muted",children:(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:e.name})})}),(0,t.jsx)("p",{className:"my-1",children:e.description})]},e.name))})})]})}
53,j=[{image_link:"https://api-ninjas.com/images/dogs/golden_retriever.jpg",good_with_children:5,good_with_other_dogs:5,shedding:4,grooming:2,drooling:2,coat_length:1,good_with_strangers:5,playfulness:4,protectiveness:3,trainability:5,energy:3,barking:1,min_life_expectancy:10,max_life_expectancy:12,max_height_male:24,max_height_female:24,max_weight_male:75,max_weight_female:65,min_height_male:23,min_height_female:23,min_weight_male:65,min_weight_female:55,name:"Golden Retriever"}],f=["Affenpinscher","Afghan Hound","Airedale Terrier","..."];class b extends a.Component{constructor(e){super(e),this.handleSubmit=this.handleSubmit.bind(this),this.handleSubmitAllDogs=this.handleSubmitAllDogs.bind(this),this.toggleFields=this.toggleFields.bind(this),this.state={disableSubmit:!1,base_url:"https://api.api-ninjas.com/v1/dogs",url1:"https://api.api-ninjas.com/v1/dogs",url2:"https://api.api-ninjas.com/v1/alldogs",param1:"golden retriever",param2:"",param3:"",param4:"",param5:"",response:j,response2:f,disableSubmitAllDogs:!1,showFields:!0}}componentDidMount(){window.Prism?.highlightAll()}toggleFields(){this.setState(e=>({showFields:!e.showFields}))}handleSubmit(){this.setState({disableSubmit:!0,response:null});let e=this.state.url1,s=[];this.state.param1&&s.push("name="+encodeURIComponent(this.state.param1)),this.state.param2&&s.push("min_height="+this.state.param2),this.state.param3&&s.push("max_height="+this.state.param3),this.state.param4&&s.push("min_weight="+this.state.param4),this.state.param5&&s.push("max_weight="+this.state.param5),s.length>0&&(e+="?"+s.join("&")),fetch(e,{headers:{"X-Api-Key":this.props.apiKey||""}}).then(e=>e.json()).then(e=>{this.setState({response:e})},e=>{}).finally(()=>{this.setState({disableSubmit:!1})}),window.gtag("event",this.state.url1.substring(27))}handleSubmitAllDogs(){this.setState({disableSubmitAllDogs:!0,response2:null});let e=this.state.url2;fetch(e,{headers:{"X-Api-Key":this.props.apiKey||""}}).then(e=>e.json()).then(e=>{this.setState({response2:e})},e=>{}).finally(()=>{this.setState({disableSubmitAllDogs:!1})}),window.gtag("event",this.state.url2.substring(27))}render(){return(0,t.jsxs)(o.Z,{title:"Dogs API - API Ninjas",description:"Dogs API by API Ninjas - detailed facts for every breed of man's best friend.",sidebarName:"Dogs",children:[(0,t.jsxs)("div",{className:"d-flex flex-column flex-md-row px-4",children:[(0,t.jsx)("div",{className:"w-100 flex-md-fill max-width-md-50 px-2",children:(0,t.jsx)("div",{className:"content-inner mx-auto mt-4",children:(0,t.jsx)("div",{className:"",children:(0,t.jsx)("div",{className:"section-block",children:(0,t.jsxs)("div",{id:"doc-header",className:"doc-header",children:[(0,t.jsx)("h1",{className:"doc-title",children:"Dogs API"}),(0,t.jsx)("p",{children:"The Dogs API provides detailed, qualitative information on over 200 different breeds of dogs."}),(0,t.jsx)("p",{children:"Available endpoints:"}),(0,t.jsxs)("ul",{children:[(0,t.jsxs)("li",{children:[(0,t.jsx)("a",{className:"bold",href:"#dogs-endpoint",children:"/v1/dogs"})," ","- Get a list of dog breeds matching specified parameters"]}),(0,t.jsxs)("li",{children:[(0,t.jsx)("a",{className:"bold",href:"#alldogs-endpoint",children:"/v1/alldogs"})," ","- Get a list of all dog breed names"]})]})]})})})})}),(0,t.jsx)("div",{className:"w-100 flex-md-fill max-width-md-50 px-2 pt-md-4",children:(0,t.jsx)("div",{className:"w-100 section-block",children:(0,t.jsx)(l.Z,{apiId:32})})})]}),(0,t.jsx)(p.Z,{count:2}),(0,t.jsx)(m.Z,{id:"dogs-endpoint",path:"/v1/dogs",children:(0,t.jsxs)("div",{className:"d-flex flex-column flex-md-row px-4",children:[(0,t.jsx)("div",{className:"w-100 flex-md-fill max-width-md-50 px-2",children:(0,t.jsx)("div",{className:"content-inner mx-auto",children:(0,t.jsx)("div",{className:"doc-section",children:(0,t.jsxs)("div",{className:"section-block",children:[(0,t.jsx)("p",{children:(0,t.jsx)("code",{children:this.state.base_url})}),(0,t.jsxs)("p",{children:["Get a list of dog breeds matching specified parameters. Returns at most ",(0,t.jsx)("strong",{children:"20"})," ","results. To access more than 20 results, use the"," ",(0,t.jsx)("code",{children:"offset"})," parameter to offset results in multiple API calls."]}),(0,t.jsxs)("div",{className:"api-block",children:[(0,t.jsx)("h4",{children:"Parameters"}),(0,t.jsxs)("p",{className:"mini-text",children:["At least one of the following parameters (excluding ",(0,t.jsx)("code",{children:"offset"}),") is required."]}),(0,t.jsxs)("ul",{className:"list-group api-list",children:[(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"name"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"The name of breed."})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"min_height"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"Minimum height in inches."})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"max_height"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"Maximum height in inches."})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"min_weight"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"Minimum weight in pounds."})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"max_weight"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"Maximum weight in pounds."})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"min_life_expectancy"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"Minimum life expectancy in years."})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"max_life_expectancy"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"Maximum life expectancy in years."})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"shedding"})}),"\xa0\xa0optional"]}),(0,t.jsxs)("p",{className:"my-1",children:["How much hair the breed sheds. Possible values: ",(0,t.jsx)("code",{children:"1"}),", ",(0,t.jsx)("code",{children:"2"}),","," ",(0,t.jsx)("code",{children:"3"}),", ",(0,t.jsx)("code",{children:"4"}),", ",(0,t.jsx)("code",{children:"5"}),", where ",(0,t.jsx)("code",{children:"1"})," indicates no shedding and ",(0,t.jsx)("code",{children:"5"})," indicates maximum shedding."]})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"barking"})}),"\xa0\xa0optional"]}),(0,t.jsxs)("p",{className:"my-1",children:["How vocal the breed is. Possible values:"," ",(0,t.jsx)("code",{children:"1"}),", ",(0,t.jsx)("code",{children:"2"}),", ",(0,t.jsx)("code",{children:"3"}),", ",(0,t.jsx)("code",{children:"4"}),", ",(0,t.jsx)("code",{children:"5"}),", where"," ",(0,t.jsx)("code",{children:"1"})," indicates minimal barking and"," ",(0,t.jsx)("code",{children:"5"})," indicates maximum barking."]})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"energy"})}),"\xa0\xa0optional"]}),(0,t.jsxs)("p",{className:"my-1",children:["How much energy the breed has. Possible values: ",(0,t.jsx)("code",{children:"1"}),", ",(0,t.jsx)("code",{children:"2"}),","," ",(0,t.jsx)("code",{children:"3"}),", ",(0,t.jsx)("code",{children:"4"}),", ",(0,t.jsx)("code",{children:"5"}),", where ",(0,t.jsx)("code",{children:"1"})," indicates low energy and ",(0,t.jsx)("code",{children:"5"})," indicates high energy."]})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"protectiveness"})}),"\xa0\xa0optional"]}),(0,t.jsxs)("p",{className:"my-1",children:["How likely the breed is to alert strangers. Possible values: ",(0,t.jsx)("code",{children:"1"}),","," ",(0,t.jsx)("code",{children:"2"}),", ",(0,t.jsx)("code",{children:"3"}),", ",(0,t.jsx)("code",{children:"4"}),", ",(0,t.jsx)("code",{children:"5"}),", where ",(0,t.jsx)("code",{children:"1"}
53)," ","indicates minimal alerting and ",(0,t.jsx)("code",{children:"5"})," ","indicates maximum alerting."]})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"trainability"})}),"\xa0\xa0optional"]}),(0,t.jsxs)("p",{className:"my-1",children:["How easy it is to train the breed. Possible values: ",(0,t.jsx)("code",{children:"1"}),", ",(0,t.jsx)("code",{children:"2"}),","," ",(0,t.jsx)("code",{children:"3"}),", ",(0,t.jsx)("code",{children:"4"}),", ",(0,t.jsx)("code",{children:"5"}),", where ",(0,t.jsx)("code",{children:"1"})," indicates the breed is very difficult to train and ",(0,t.jsx)("code",{children:"5"})," ","indicates the breed is very easy to train."]})]}),(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"offset"})}),"\xa0\xa0optional"]}),(0,t.jsx)("p",{className:"my-1",children:"Number of results to offset for pagination."})]})]})]}),(0,t.jsxs)("div",{className:"api-block",children:[(0,t.jsx)("h4",{children:"Headers"}),(0,t.jsx)("ul",{className:"list-group api-list",children:(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"X-Api-Key"})}),"\xa0\xa0required"]}),(0,t.jsx)("p",{className:"my-1",children:"API Key associated with your account."})]})})]}),(0,t.jsxs)("div",{className:"api-block",children:[(0,t.jsx)("h4",{children:"Response"}),(0,t.jsxs)("p",{className:"mb-3",children:["A JSON array of objects, each containing the following fields, or ",(0,t.jsx)(r(),{href:"/error-codes",className:"bold",children:"an error"})," if the request is unsuccessful."]}),(0,t.jsx)(g,{show:this.state.showFields,onToggle:this.toggleFields})]})]})})})}),(0,t.jsx)("div",{className:"w-100 flex-md-fill max-width-md-50 px-2",children:(0,t.jsxs)("div",{className:"doc-section section-block content-inner",children:[(0,t.jsx)(h.Z,{hasUser:this.props.hasUser,apiKey:this.props.apiKey||"",url:this.state.url1+(this.state.param1||this.state.param2||this.state.param3||this.state.param4||this.state.param5?"?"+[this.state.param1?"name="+encodeURIComponent(this.state.param1):"",this.state.param2?"min_height="+this.state.param2:"",this.state.param3?"max_height="+this.state.param3:"",this.state.param4?"min_weight="+this.state.param4:"",this.state.param5?"max_weight="+this.state.param5:""].filter(e=>e).join("&"):""),onSubmit:()=>this.handleSubmit(),disableSubmit:this.state.disableSubmit,response:this.state.response,defaultResponse:j,onRestore:()=>this.setState({response:j}),children:(0,t.jsxs)("div",{className:"rounded-pill mt-3",children:[(0,t.jsx)("label",{className:"sr-only",htmlFor:"inlineFormInputGroup",children:"Breed Name"}),(0,t.jsxs)("div",{className:"input-group mb-2",children:[(0,t.jsx)("div",{className:"input-group-prepend",children:(0,t.jsx)("div",{className:"input-group-text",children:"name"})}),(0,t.jsx)("input",{id:"sample-api-request",className:"form-control api-example-query",defaultValue:this.state.param1,onChange:e=>this.setState({param1:e.currentTarget.value})})]}),(0,t.jsxs)("div",{className:"input-group mb-2",children:[(0,t.jsx)("div",{className:"input-group-prepend",children:(0,t.jsx)("div",{className:"input-group-text",children:"min_height"})}),(0,t.jsx)("input",{id:"sample-api-request-2",className:"form-control api-example-query",defaultValue:this.state.param2,onChange:e=>this.setState({param2:e.currentTarget.value})})]}),(0,t.jsxs)("div",{className:"input-group mb-2",children:[(0,t.jsx)("div",{className:"input-group-prepend",children:(0,t.jsx)("div",{className:"input-group-text",children:"max_height"})}),(0,t.jsx)("input",{id:"sample-api-request-3",className:"form-control api-example-query",defaultValue:this.state.param3,onChange:e=>this.setState({param3:e.currentTarget.value})})]}),(0,t.jsxs)("div",{className:"input-group mb-2",children:[(0,t.jsx)("div",{className:"input-group-prepend",children:(0,t.jsx)("div",{className:"input-group-text",children:"min_weight"})}),(0,t.jsx)("input",{id:"sample-api-request-4",className:"form-control api-example-query",defaultValue:this.state.param4,onCh
53ange:e=>this.setState({param4:e.currentTarget.value})})]}),(0,t.jsxs)("div",{className:"input-group mb-2",children:[(0,t.jsx)("div",{className:"input-group-prepend",children:(0,t.jsx)("div",{className:"input-group-text",children:"max_weight"})}),(0,t.jsx)("input",{id:"sample-api-request-5",className:"form-control api-example-query",defaultValue:this.state.param5,onChange:e=>this.setState({param5:e.currentTarget.value})})]})]})}),(0,t.jsxs)("div",{id:"searchcodeexample",className:"api-block my-4",children:[(0,t.jsx)("h4",{children:"Code Examples"}),(0,t.jsx)(d.Z,{samples:x,apiKey:this.props.apiKey})]}),(0,t.jsx)("div",{children:(0,t.jsx)("p",{className:"font-14",children:"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation."})})]})})]})}),(0,t.jsx)(m.Z,{id:"alldogs-endpoint",path:"/v1/alldogs",children:(0,t.jsxs)("div",{className:"d-flex flex-column flex-md-row px-4",children:[(0,t.jsx)("div",{className:"w-100 flex-md-fill max-width-md-50 px-2",children:(0,t.jsx)("div",{className:"content-inner mx-auto",children:(0,t.jsx)("div",{className:"doc-section",children:(0,t.jsxs)("div",{className:"section-block",children:[(0,t.jsx)("p",{className:"m-0",children:(0,t.jsx)("a",{href:"/pricing",className:"new-box font-12",children:"Premium only"})}),(0,t.jsx)("p",{children:(0,t.jsx)("code",{children:this.state.url2})}),(0,t.jsx)("p",{children:"Returns a list of all dog breed names."}),(0,t.jsxs)("div",{className:"api-block",children:[(0,t.jsx)("h4",{children:"Parameters"}),(0,t.jsx)("p",{children:"None"})]}),(0,t.jsxs)("div",{className:"api-block",children:[(0,t.jsx)("h4",{children:"Headers"}),(0,t.jsx)("ul",{className:"list-group api-list",children:(0,t.jsxs)("li",{className:"list-group-item px-3 py-2 light-bg",children:[(0,t.jsxs)("h5",{className:"my-1 text-muted",children:[(0,t.jsx)("strong",{children:(0,t.jsx)("code",{children:"X-Api-Key"})}),"\xa0\xa0required"]}),(0,t.jsx)("p",{className:"my-1",children:"API Key associated with your account."})]})})]}),(0,t.jsxs)("div",{className:"api-block",children:[(0,t.jsx)("h4",{children:"Response"}),(0,t.jsxs)("p",{className:"mb-3",children:["A JSON array of strings, or ",(0,t.jsx)(r(),{href:"/error-codes",className:"bold",children:"an error"})," if the request is unsuccessful."]})]})]})})})}),(0,t.jsx)("div",{className:"w-100 flex-md-fill max-width-md-50 px-2",children:(0,t.jsxs)("div",{className:"doc-section section-block content-inner",children:[(0,t.jsx)(h.Z,{hasUser:this.props.hasUser,apiKey:this.props.apiKey||"",url:this.state.url2,onSubmit:()=>this.handleSubmitAllDogs(),disableSubmit:this.state.disableSubmitAllDogs,response:this.state.response2,defaultResponse:f,onRestore:()=>this.setState({response2:f})}),(0,t.jsxs)("div",{className:"api-block my-4",children:[(0,t.jsx)("h4",{children:"Code Examples"}),(0,t.jsx)(d.Z,{samples:(0,c.p7)("/v1/alldogs"),apiKey:this.props.apiKey})]})]})})]})})]})}}},67509:function(e,s,i){"use strict";var t=i(85893);i(67294);var a=i(14915),n=i(8998),r=i.n(n);let l=e=>{let{count:s}=e;return(0,t.jsxs)("div",{className:r().toolbar,children:[(0,t.jsxs)("span",{className:r().toolbarLabel,children:[s," endpoints"]}),(0,t.jsxs)("span",{className:r().toolbarActions,children:[(0,t.jsx)("button",{type:"button",className:r().toolbarBtn,onClick:()=>(0,a.dU)(!0),children:"Expand all"}),(0,t.jsx)("button",{type:"button",className:r().toolbarBtn,onClick:()=>(0,a.dU)(!1),children:"Collapse all"})]})]})};s.Z=l},6055:function(e,s,i){"use strict";i.d(s,{p7:function(){return a}});let t="https://api.api-ninjas.com";function a(e,s){let i=function(e,s){let i=e.startsWith("/")?e:`/${e}`,a=s?Array.isArray(s)?s:Object.entries(s):[];if(0===a.length)return`${t}${i}`;let n=a.map(e=>{let[s,i]=e;return`${encodeURIComponent(s)}=${encodeURIComponent(String(i)).replace(/%2C/g,",")}`}).join("&");return`${t}${i}?${n}`}(e,s);return{curl:`curl -X GET "${i}" \\ 54 -H "X-Api-Key: YOUR_API_KEY"`,python:`import requests 55 56api_url = '${i}' 57response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) 58if response.status_code == requests.codes.ok: 59 print(response.text) 60else: 61 print("Error:", response.status_code, response.text)`,javascript:`$.ajax({ 62 method: 'GET', 63 url: '${i}', 64 headers: { 'X-Api-Key': 'YOUR_API_KEY'}, 65 contentType: 'application/json', 66 success: function(result) { 67 console.log(result); 68 }, 69 error: function ajaxError(jqXHR) { 70 console.error('Error: ', jqXHR.responseText); 71 } 72});`,nodejs:`const request = require('request'); 73 74request.get({ 75 url: '${i}', 76 headers: { 77 'X-Api-Key': 'YOUR_API_KEY' 78 }, 79}, function(error, response, body) { 80 if(error) return console.error('Request failed:', error); 81 else if(response.statusCode != 200) return console.error('Error:', response.statusCode, body.toString('utf8')); 82 else console.log(body); 83});`,java:`import java.io.InputStream; 84import java.net.HttpURLConnection; 85import java.net.URL; 86 87import com.fasterxml.jackson.databind.JsonNode; 88import com.fasterxml.jackson.databind.ObjectMapper; 89 90URL url = new URL("${i}"); 91HttpURLConnection connection = (HttpURLConnection) url.openConnection(); 92connection.setRequestProperty("accept", "application/json"); 93connection.setRequestProperty("X-Api-Key", "YOUR_API_KEY"); 94InputStream responseStream = connection.getInputStream(); 95ObjectMapper mapper = new ObjectMapper(); 96JsonNode root = mapper.readTree(responseStream); 97System.out.println(root.toString());`,swift:`let url = URL(string: "${i}")! 98var request = URLRequest(url: url) 99request.setValue("YOUR_API_KEY", forHTTPHeaderField: "X-Api-Key") 100 101let task = URLSession.shared.dataTask(with: request) { (data, response, error) in 102 guard let data = data else { return } 103 print(String(data: data, encoding: .utf8)!) 104} 105 106task.resume()`}}}},function(e){e.O(0,[14289,27919,71979,10241,47269,84205,49774,92888,40179],function(){return e(e.s=63658)}),_N_E=e.O()}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.