Skip to content

Example

rulesio edited this page Nov 30, 2012 · 3 revisions
{ 
  "base_url" : "https://github.com/api/v3/",
  "version" : "0.1",
  "methods" : {
  
  "update_user_profile": {
      "description": "Update your profile"
      "path" : "/user",
      "method" : "PATCH",
      "format" : "json",
      "required_params" : [
      ],
      "optional_params" : [
        "name",
        {"email": "/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/"},
        {"blog": "'/^(https?|ftp):\/\/(?:[A-Z0-9-]+.)+[A-Z]{2,6}([\/?].+)?$/i'"}, // URL RegEx
        "company",
        "location",
        {"hireable": "boolean"},
        "bio"
      ],
      "authentication" : true,
      "errorResponses":[
        {
          "reason":"{{message}}", //Problem parsing or wrong type of JSON
          "code":400
        },
        {
          "reason":"{{message}} on {{errors}}",
          "code":422
        },
        {
          "reason":"User not found",
          "code":403
        }
      ],
      "expected_status" : [ 200 ]
    },
  
    "update_location": {
      "description": "Only update your location",
      "path" : "/user",
      "method" : "PATCH",
      "format" : "json",
      "required_params" : [
        "location"
      ],
      "authentication" : true,
      "errorResponses":[
        {
          "reason":"{{message}}", //Problem parsing or wrong type of JSON
          "code":400
        },
        {
          "reason":"{{message}} on {{errors}}",
          "code":422
        },
        {
          "reason":"User not found",
          "code":403
        }
      ],
      "expected_status" : [ 200 ]
    }
  },
  
  "expected_status" : [ 200 ],
  
  "errorResponses":[
    {
      "reason":"User not found",
      "code":403
    },
    {
      "reason":"User not found",
      "code":404
    }
  ],
  
  "authentication": {
    "type": "oauth";
  },
  
  "name" : "GitHub",
  "authority" : "Traction.io",
  "meta" : {
    "documentation" : "http://develop.github.com/"
  }
}
Clone this wiki locally