Skip to content
madhavipuliraju edited this page Nov 17, 2015 · 5 revisions

Welcome to the Outreach Portal API wiki !

REST APIs

  • All API access is over HTTP and data is sent and received as JSON.
  • To use the API layer, your application will make an HTTP request and parse the response.
  • The response format is JSON.
  • Your methods will be the standard HTTP methods like GET, PUT and POST.
  • Appropriate HTTP verbs for each action are listed below:
Verb Description
GET Used for retrieving resources.
PUT Used for replacing resources or collections.
POST Used for creating resources.

Resources

Following is the list of current REST APIs provided by outreach portal:

- /roles [GET, POST]
- /roles/<int:id> [GET, PUT, DELETE]
- /roles/<int:id>?fields=field1,field2 [GET]
- /roles?query_param1=val1&query_param2=val2&..query_paramn=valn [GET]
- /users [GET, POST]
- /users/<int:id> [GET, PUT, DELETE]
- /users/<int:id>?fields=field1,field2 [GET]
- /users?query_param1=val1&query_param2=val2&..query_paramn=valn [GET]
- /workshop_documents [GET, POST]
- /workshop_documents/<int:id> [GET, PUT, DELETE]
- /workshop_documents/<int:id>?fields=field1,field2 [GET]
- /workshop_documents?query_param1=val1&query_param2=val2&..query_paramn=valn [GET]

/roles

  • Parameters
Name Description
id Indicates the unique id of the role. Example Value: 2
name Specifies the name of role. Example Value: Admin
  • GET
    • Example Request
      /roles
              
    • Example Result
      [{"id": 1, "name": "admin"}, {"id": 2, "name": "OC"}, {"id": 3, "name": "NC"}]
              
  • POST
    • Example Request
       json =  {
          "name" : "Admin"
      }
              
    • Example Result
      {
        "id": 1, 
        "name": "Admin"
      }
              

/roles/int:id

  • Parameters
Name Description
id Indicates the unique id of the role. Example Value: 2
name Specifies the name of role. Example Value: Admin
  • GET
    • Example Request
      /roles/1 
              
    • Example Result
      {
       "id": 1, 
       "name": "Admin"
      }
              
  • PUT
    • Example Request
      name = {"name":"Outreach Coordinator"}
              
    • Example Result
      {
       "id": 1, 
       "name": "Outreach Coordinator"
      }
              
  • DELETE
    • Example Result
      {
        "id": "4", 
        "status": "success"
      }
              

/roles/int:id?fields=field1,field2

  • Parameters
Name Description
name Returns the name of the role
id Indicates a unique id assigned to the role
  • GET -
    • Example Request
      /roles/2?fields=name,id
              
    • Example Result
      {
        "id": 2, 
        "name": "OC"
      }
              

/roles?query_param1=val1&query_param2=val2&..query_paramn=valn

  • Parameters
Name Description
name Returns the name of the role
id Indicates a unique id assigned to the role
  • GET
    • Example Request
      /roles?name=OC
              
    • Example Result
      [{"id": 2, "name": "OC"}]
              

/users

  • Parameters
Name Description
id Indicates the unique id of the user. Example Value: 2
name Specifies the name of user. Example Value: John
email Specifies the email of user. Example Value: [email protected]
role Indicates the role of the user. Example Value: Admin, OC, NC
  • GET
    • Example Request
      /users
              
    • Example Result
      [{"name": "John", "last_active": "2015-11-17T09:31:29", "created":
      "2015-11-17T09:31:29", "email": "[email protected]", "role": {"id": 1, "name":
      "Admin"}, "id": 1}]
              
  • POST
    • Example Request
      json =  {
      "name" : "John",
      "email" : "[email protected]",
      "role" : { "id" : 1 }  
       }
              
    • Example Result
      {
        "created": "2015-11-17T09:31:29", 
        "email": "[email protected]", 
        "id": 1, 
        "last_active": "2015-11-17T09:31:29", 
        "name": "John", 
        "role": {
          "id": 1, 
          "name": "Admin"
        }
      }
              

/users/int:id

  • Parameters
Name Description
id Indicates the unique id of the user. Example Value: 2
name Specifies the name of user. Example Value: John
email Specifies the email of user. Example Value: [email protected]
role Indicates the role of the user. Example Value: Admin, OC, NC
  • GET
    • Example Request
      /users/1 
              
    • Example Result
      {
        "created": "2015-11-17T09:31:29", 
        "email": "[email protected]", 
        "id": 1, 
        "last_active": "2015-11-17T09:31:29", 
        "name": "John", 
        "role": {
          "id": 1, 
          "name": "Admin"
        }
      }
              
  • PUT
    • Example Request
      name = {"name":"jane"}
              
    • Example Result
      {
        "created": "2015-11-17T09:31:29", 
        "email": "[email protected]", 
        "id": 1, 
        "last_active": "2015-11-17T09:31:29", 
        "name": "Jane", 
        "role": {
          "id": 1, 
          "name": "Admin"
        }
      }
              
  • DELETE
    • Example Result
      {
        "id": "1", 
        "status": "success"
      }
              

/users/int:id?fields=field1,field2

  • Parameters
Name Description
id Indicates the unique id of the user. Example Value: 2
name Specifies the name of user. Example Value: John
email Specifies the email of user. Example Value: [email protected]
role Indicates the role of the user. Example Value: Admin, OC, NC
  • GET
    • Example Request
      /users/4?fields=name,email
              
    • Example Result
      {
        "created": "2015-11-17T09:41:20", 
        "email": "[email protected]", 
        "id": 4, 
        "last_active": "2015-11-17T09:41:20", 
        "name": "John", 
        "role": {
          "id": 1, 
          "name": "Admin"
        }
      }
              

/users?query_param1=val1&query_param2=val2&..query_paramn=valn

  • Parameters
Name Description
id Indicates the unique id of the user. Example Value: 2
name Specifies the name of user. Example Value: John
email Specifies the email of user. Example Value: [email protected]
role Indicates the role of the user. Example Value: Admin, OC, NC
  • GET -
    • Example Request
      /users?name=John&[email protected]
              
    • Example Result
      [{"name": "John", "last_active": "2015-11-17T09:41:20", "created":
      "2015-11-17T09:41:20", "email": "[email protected]", "role": {"id": 1, "name":
      "Admin"}, "id": 1}]
              

/workshop_documents

  • Parameters
Name Description
id Indicates the unique id of the workshop_document. Example Value: 2
name Specifies the name of workshop_document. Example Value: Attendance Sheet, Feedback Form, College Report
path Specifies the path of workshop_document. Example Value: /outreach-portal/workshop-docs/admin
  • GET
    • Example Request
      /workshop_documents
              
    • Example Result
      [{"path": "/outreach-portal/workshop-docs/admin", "id": 1, "name": "Attendance
      Sheet"}, {"path": "/outreach-portal/workshop-docs/admin", "id": 2, "name":
      "Feedback Form"}, {"path": "/outreach-portal/workshop-docs/admin", "id": 3,
      "name": "College Report"}]
              
  • POST
    • Example Request
       json =  {
        "name" : "Attendance Sheet",
        "path" : "/outreach-portal/workshop-docs/admin"
      }
              
    • Example Result
      {
        "id": 1, 
        "name": "Attendance Sheet", 
        "path": "/outreach-portal/workshop-docs/admin"
      }
              

/workshop_documents/int:id

  • Parameters
Name Description
id Indicates the unique id of the workshop_document. Example Value: 2
name Specifies the name of workshop_document. Example Value: Attendance Sheet, Feedback Form, College Report
path Specifies the path of workshop_document. Example Value: /outreach-portal/workshop-docs/admin
  • GET
    • Example Request
      /workshop_documents/1 
              
    • Example Result
      {
       "id": 1, 
       "name": "Attendance Sheet", 
       "path": "/outreach-portal/workshop-docs/admin"
      }
              
  • PUT
    • Example Request
      name = {"name":"Feedback Form"}
              
    • Example Result
      {
       "id": 1, 
       "name": "Feedback Form", 
       "path": "/outreach-portal/workshop-docs/admin"
      }
      
              
  • DELETE
    • Example Result
      {
        "id": "1", 
        "status": "success"
      }
              

/workshop_documents/int:id?fields=field1,field2

  • Parameters
Name Description
id Indicates the unique id of the workshop_document. Example Value: 2
name Specifies the name of workshop_document. Example Value: Attendance Sheet, Feedback Form, College Report
path Specifies the path of workshop_document. Example Value: /outreach-portal/workshop-docs/admin
  • GET
    • Example Request
      /workshop_documents/2?fields=name,path
              
    • Example Result
      {
        "id": 2, 
        "name": "Feedback Form", 
        "path": "/outreach-portal/workshop-docs/admin"
      }
              

/workshop_documents?query_param1=val1&query_param2=val2&..query_paramn=valn

  • Parameters
Name Description
id Indicates the unique id of the workshop_document. Example Value: 2
name Specifies the name of workshop_document. Example Value: Attendance Sheet, Feedback Form, College Report
path Specifies the path of workshop_document. Example Value: /outreach-portal/workshop-docs/admin
  • GET
    • Example Request
      /workshop_documents?name=Attendance Sheet
              
    • Example Result
      [{"path": "/outreach-portal/workshop-docs/admin", "id": 1, "name": "Attendance Sheet"}]