Skip to content

Instantly share code, notes, and snippets.

@emiralp
Last active March 12, 2018 10:33
Show Gist options
  • Select an option

  • Save emiralp/010e3cc7119ab4a39d4b to your computer and use it in GitHub Desktop.

Select an option

Save emiralp/010e3cc7119ab4a39d4b to your computer and use it in GitHub Desktop.
cmd.fm api v.1 (beta)

USERS

/api/users/sign_up
	username				(Required)
	email					(Required)
	password				(Required)
	password_confirmation	(Required)
	
/api/users/sign_in
	username_or_email		(Required)
	password				(Required)

/api/users/sign_out
	
/api/users/retrieve
	email					(Required)
	
/api/users/resend
	email					(Required)
	
/api/users/update
	password
	password_confirmation
	username
	name
	surname
	gender
	bio

/api/users/profile/:username
	No parameters required.

/api/users/:username/playlists
	No parameters required.

/api/users/my_comments
	No parameters required.

/api/users/remove_comment
	comment_id				(Required)

##################################################################

TRACKS & GENRES

/api/genres
	No parameters required.
	
/api/tracks/search
	genre or track_id		(Required)

/api/tracks/:track_id/like
	No parameters required.

/api/tracks/:track_id/unlike
	No parameters required.

/api/tracks/likes
	No parameters required.

/api/tracks/:track_id/add_comment
	body					(Required)
	sec						(Required)

/api/tracks/:track_id/comments
	No parameters required.

##################################################################

PLAYLISTS

/api/playlists/new
	name					(Required)
	description				(Required)

/api/playlists
	username				(Required)
	playlist_name			(Required)

/api/playlists/:playlist_name/update
	name					
	description				
	
/api/playlists/:playlist_name/add/:track_id
	No parameters required.

/api/playlists/:playlist_name/remove/:track_id
	No parameters required.

/api/playlists/:playlist_name/destroy
	No parameters required.

##################################################################

LAYOUTS

/api/layouts/index
	No parameters required.

##################################################################

@hack9367
Copy link
Copy Markdown

hack9367 commented May 6, 2015

cool

@dlion
Copy link
Copy Markdown

dlion commented May 15, 2015

I have some questions: I have tried
curl -X POST -d "username_or_email=DLion" -d "password=password123" "https://cmd.fm/api/users/sign_in"
And I received this:

<!DOCTYPE html>
<html>
<head>
  <title>The change you wanted was rejected (422)</title>
  <style>
  body {
    background-color: #EFEFEF;
    color: #2E2F30;
    text-align: center;
    font-family: arial, sans-serif;
  }

  div.dialog {
    width: 25em;
    border: 1px solid #CCC;
    border-right-color: #999;
    border-left-color: #999;
    border-bottom-color: #BBB;
    border-top: #B00100 solid 4px;
    border-top-left-radius: 9px;
    border-top-right-radius: 9px;
    background-color: white;
    padding: 7px 4em 0 4em;
  }

  h1 {
    font-size: 100%;
    color: #730E15;
    line-height: 1.5em;
  }

  body > p {
    width: 33em;
    margin: 0 auto 1em;
    padding: 1em 0;
    background-color: #F7F7F7;
    border: 1px solid #CCC;
    border-right-color: #999;
    border-bottom-color: #999;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
    border-top-color: #DADADA;
    color: #666;
    box-shadow:0 3px 8px rgba(50, 50, 50, 0.17);
  }
  </style>
</head>

<body>
  <!-- This file lives in public/422.html -->
  <div class="dialog">
    <h1>The change you wanted was rejected.</h1>
    <p>Maybe you tried to change something you didn't have access to.</p>
  </div>
  <p>If you are the application owner check the logs for more information.</p>
</body>
</html>

Why ?
I tried using another way and I received:

{ status: '422', error: 'Unprocessable Entity' }

What's wrong with my request ?

@mrsum
Copy link
Copy Markdown

mrsum commented Jul 29, 2015

Is CORS disabled?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment