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 6785425
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:07:31+00:00 2026-05-26T17:07:31+00:00

I’ve decided that I’m going to write an API for my music site. Something

  • 0

I’ve decided that I’m going to write an API for my music site. Something that I really want is to implement REST when creating my API. If I wanted the functionality to say, play the next song via the API, how would I go about doing this?

As far as my constructed URL would go, would it be something like API/{ID}/NextSong, API/{ID}/?NextSong, or API/{ID}?NextSong. Or would it be something a bit different than that?

As far as the code side goes, I plan on have the web service running in PHP. I would need some sort of authentication step. What would be the best way to authenticate a user with the API? (I’d imagine that there is probably a really good online resource or something for this.)

Finally, the music player is in HTML5 and Javascript/jQuery. What’s the best way to get the player to actually go to the next song using the web service? I have a nextSong() javascript function, but I’m not sure how to access it. The only thing I can think of is some sort of polling, be it AJAX long-polling, or just timed polling. Is there any other better, more efficient way of doing this?

Thanks for any help, all I really need is a push in the right direction, a lot of what I know so far is due to my experience with Microsoft’s listdata.svc RESTful webservice in Sharepoint 2010. The rest of my knowledge is restricted to this article about REST APIs in PHP.

  • 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-05-26T17:07:31+00:00Added an answer on May 26, 2026 at 5:07 pm

    If you have an URL with “NextSong” in it that would mean you would have to have every users state saved on the server. If I would have a player and work with AJAX against a REST-API I would let the server just be “stupid servant” that does everything I tell it to do and let the logic be on the client side.

    For example I would have a service for getting a playlist in JSON or XML format. Parse this on the client. When you listen to a song in that playlist you know where in the playlist you are and when the users or player asks for the next song the musicplayer will look in the playlist (saved in array of objects maybe a linked list where you have properties for previous song and next song?), call the service for start playing song id #####. For example API/{ID}/Play/{SongID} or API/{ID}/Song/{SongID}.

    Regards

    (EDIT Fixed Typo)

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

Sidebar

Related Questions

I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I've got a string that has curly quotes in it. I'd like to replace
I want use html5's new tag to play a wav file (currently only supported
i want to parse a xhtml file and display in UITableView. what is the
I need a function that will clean a strings' special characters. I do NOT
I want to construct a data frame in an Rcpp function, but when I

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.