MusicGraph API Documentation

User API

API calls for creating and managing users in your peprsonal user graph

The base URL path for users is: http://api.musicgraph.com/api/v2/user/

Create User

Creates users associated with your account/graph. Requires HTTP POST request.

Parameter Required Description Example
api_key yes The developer API key api_key=[your-api-key]
user_id yes Your internal user id ex: 12345
first_name no   ex: Mary
last_name no   ex: Jane
gender no values; male/female or m/f, validated  
location no city,state,region ex: Miami Beach, Florida, US
country no ISO_3166-1 alpha-2 country code e.g. us, br, es, validated ex: US
birthday no format: "mm/dd/yyyy", "mm/dd/yy", "mm-dd-yyyy", "mm-dd-yy", validated ex: 01/01/1999
language no ISO 639-1 e.g. en, es, pt, validated ex: en
email no   ex: mj@email.com

Example POST

        curl -X POST -H "Content-Type: application/json" -d '{
          "user_id":"123456",  
          "first_name":"Mary", 
          "last_name":"Jane", 
          "gender":"female", 
          "location":"Miami Beach, Florida, US", 
          "country":"us", 
          "birthday":"01/01/1999",  
          "language":"en", 
          "email":"mj@email.com"
          }' http://api.musicgraph.com/api/v2/user?api_key=c8303e90962e3a5ebd5a1f260a69b138
    

Example Response

       {
         "status": {
              "code": 0, 
              "message": 
              "Success", 
              "api": "v2"
         }, 
         data: {
              "id":"7f2578ee-e4dd-112d-51e6-0e4031bf74d3",
              "user_id":"123456"
              "user_first_name":"Mary", 
              "user_last_name":"Jane", 
              "user_gender":"female", 
              "user_location":"Miami Beach, Florida, US", 
              "user_country":"us", 
              "user_birthday":"01/01/1999",  
              "user_language":"en", 
              "user_email":"mj@email.com",
              "date_created": "1418147166",
              "date_last_modified": "1418147166",
              "status": "active",
              "account_id": "2445580905922"  <= personal user graph id, used to namespace userid's
          }
       }
    

Get User

Retrieves user profile information.

Parameter Required Description Example
api_key yes The developer API key api_key=[your-api-key]
user_id yes Namespaced userid e.g. [account_id]:[user_id] ex. 2445580905922:123456

Example GET

      curl -X GET -H "Content-Type: application/json" http://api.musicgraph.com/api/v2/user/2445580905922:123456?api_key=c8303e90962e3a5ebd5a1f260a69b138
    

Example Response

       {
         "status": {
              "code": 0, 
              "message": 
              "Success", 
              "api": "v2"
         }, 
         data: {
              "id":"7f2578ee-e4dd-112d-51e6-0e4031bf74d3",
              "user_id":"123456"
              "user_first_name":"Mary", 
              "user_last_name":"Jane", 
              "user_gender":"female", 
              "user_location":"Miami Beach, Florida, US", 
              "user_country":"us", 
              "user_birthday":"01/01/1999",  
              "user_language":"en", 
              "user_email":"mj@email.com",
              "date_created": "1418147166",
              "date_last_modified": "1418147166",
              "status": "active",
              "account_id": "2445580905922"  <= private graph id, used to namespace userid's
          }
       }
    

Update User

Provides the ability to update the users profile. Requires HTTP PUT request.

Parameter Required Description Example
api_key yes The developer API key api_key=[your-api-key]
user_id yes Namespaced userid e.g. [account_id]:[user_id] ex. 2445580905922:123456

Updatable fields are:

first_name, last_name, gender, location, country, birthday, email, status (values are "active", "inactive", "deleted")

Example PUT

        curl -X PUT -H "Content-Type: application/json" -d '{"email":"maryjane@email.com"}' http://api.musicgraph.com/api/v2/user/2445580905922:123456?api_key=c8303e90962e3a5ebd5a1f260a69b138
    

Example Response

       {
         "status": {
              "code": 0, 
              "message": 
              "Success", 
              "api": "v2"
         }, 
         data: {
              "id":"7f2578ee-e4dd-112d-51e6-0e4031bf74d3",
              "user_id":"123456"
              "user_first_name":"Mary", 
              "user_last_name":"Jane", 
              "user_gender":"female", 
              "user_location":"Miami Beach, Florida", 
              "user_country":"us", 
              "user_birthday":"01/01/1999",  
              "user_language":"en", 
              "user_email":"maryjane@email.com",
              "date_created": "1418147166",
              "date_last_modified": "1418147166",
              "status": "active",
              "account_id": "2445580905922"  <= private graph id, used to namespace userid
          }
       }