Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
Requesting user information from api with axios in react

so I'm doing this assignment and can't seem to understand how to make the request that I'm being asked to do, the information given is the following (going to be editing the names):

api url: https://this.api.com/entity

api apikey: somePa$$word

and 2 endpoints to get information based on an user info:

/category/userID=11111111

/category/userPassport=20111111113

An example of usage was given: screenshot of example

I'm not really clear on how to write this and so far every post I found doesn't work.

What I have so far:

const [apiData, setApiData] = useState(null);
  useEffect(() => {
    axios
      .get(
         //testing attaching the endpoint as the example shows?
        'https://this.api.com/entity/category/userID=11111111', 
        {
          headers: {
            Authorization: `Apikey somePa$$word`,
          },
        }
      )
      .then((res) => {
        setApiData(res.data);
        console.log('axios: ' + res.data);
      });
      .catch((error) => {
        console.log('axios: ' + error);
      });
  }, []);

I get these errors in the console: console errors

First time I ask a question here and I hope the info I provided is enough, if anything else is needed pls let me know.

Thanks you

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

try this

axios
      .get(
         //testing attaching the endpoint as the example shows?
        'https://this.api.com/entity/category/userID=11111111', 
        {
          headers: {
            Authorization: `Apikey somePa$$word`,
            'Access-Control-Allow-Origin': '*',
          },
        }
      )
about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!