Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7883819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T04:38:10+00:00 2026-06-03T04:38:10+00:00

I am currently building a website that uses data from a JSON based REST

  • 0

I am currently building a website that uses data from a JSON based REST API. I need to retrieve a JSON file from a specific URL but I am struggling with how to access it because the API requires a username and password.

I have a javascript variable containing the url that I need to get the data from, as well as the correct username and password. I just dont know how to put it all together to make a request.

–

Alternatively, I have managed to find a php class that very easily and simply returns PHP arrays for all the data i need. I simply append my username and password inside a php file and the class takes care of the rest. This maybe an easier way to access the JSON rather than using javascript? However I have no idea how I can pass a javascript URL variable into it.

Thanks a lot for your help. I hope i’ve made my problem clear!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T04:38:12+00:00Added an answer on June 3, 2026 at 4:38 am

    I’m assuming that the REST API is using basic access authentication as the authentication mechanism. You can read from the article that all it takes is to properly set the Authorization request header and here’s an example of how you can do it in JavaScript with jQuery.

    It’s a very simple authentication scheme and one of it’s implications is that you would have to supply the user’s client with the username and password that can be easily decoded back to plain text. Considering that most terms of services prohibit you from disclosing your access credentials, you’ll probably want to either retrieve the data in PHP or expose a REST interface in PHP that proxies the requests to the actual API, unless you’re using the JS client for personal purposes only.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently building a chrome extension that pulls data from a Drupal 6 website,
I am currently building a Website that uses a blackletter font. I try to
Im building a website/webapp that uses sockets.io Currently if the user is using safari
I am currently building an making my new website. It uses one page and
I'm currently building a website which contains video material from a YouTube channel. The
I am currently building a website in codeigniter that is one page site, basically
In the website I'm currently building we need a large number of dynamic redirects,
I am currently building a website that has certain images, when clicked will open
I am currently building a charity student support website, to help African students that
I'm currently building a job-board website with CodeIgniter 2.0 that is very user content

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.