# Scholarships

With scholarships' API you add new applications or apply students to a scholarship. You can also pull details from sent applications.

See scholarship instance for more details.

# List

You need to fetch list of published scholarships to begin working with scholarships' API.

GET /api/scholarship

{
    "data": [
        {
            "type": "scholarship",
            "id": "2c742be9-3adf-11e9-993c-7824afb64838",
            "attributes": {
                "title": "Test scholarship",
                "description": "Scholarship description",
                "amount": 400,
                "awards": 1,
                "start": "2019-02-18T00:00:00+00:00",
                "deadline": "2019-03-22T23:59:59+00:00",
                "timezone": "America/New_York",
                "recurringValue": null,
                "recurringType": null,
                "isFree": false,
                "expiredAt": null
            },
            "meta": {
                "next": null
            },
            "links": {
                "self": "/scholarship/2c742be9-3adf-11e9-993c-7824afb64838"
            }
        }
    ]
}

# Fields

You need to get scholarships' fields before making new application request.

GET /api/scholarship/@id/fields or add ?include=fields to scholarship item request.

{
    "data": [
        {
            "type": "scholarship_field",
            "id": "43892",
            "attributes": {
                "eligibilityType": null,
                "eligibilityValue": null
            },
            "links": {
                "self": "/scholarship_field/43892"
            },
            "relationships": {
                "field": {
                    "links": {
                        "self": "/scholarship_field/43892/relationships/field",
                        "related": "/scholarship_field/43892/field"
                    },
                    "data": {
                        "type": "field",
                        "id": "name"
                    }
                }
            }
        },
        {
            "type": "scholarship_field",
            "id": "43893",
            "attributes": {
                "eligibilityType": null,
                "eligibilityValue": null
            },
            "links": {
                "self": "/scholarship_field/43893"
            },
            "relationships": {
                "field": {
                    "links": {
                        "self": "/scholarship_field/43893/relationships/field",
                        "related": "/scholarship_field/43893/field"
                    },
                    "data": {
                        "type": "field",
                        "id": "phone"
                    }
                }
            }
        },
        {
            "type": "scholarship_field",
            "id": "43894",
            "attributes": {
                "eligibilityType": null,
                "eligibilityValue": null
            },
            "links": {
                "self": "/scholarship_field/43894"
            },
            "relationships": {
                "field": {
                    "links": {
                        "self": "/scholarship_field/43894/relationships/field",
                        "related": "/scholarship_field/43894/field"
                    },
                    "data": {
                        "type": "field",
                        "id": "email"
                    }
                }
            }
        },
        {
            "type": "scholarship_field",
            "id": "43895",
            "attributes": {
                "eligibilityType": null,
                "eligibilityValue": null
            },
            "links": {
                "self": "/scholarship_field/43895"
            },
            "relationships": {
                "field": {
                    "links": {
                        "self": "/scholarship_field/43895/relationships/field",
                        "related": "/scholarship_field/43895/field"
                    },
                    "data": {
                        "type": "field",
                        "id": "state"
                    }
                }
            }
        }
    ],
    "included": [
        {
            "type": "field",
            "id": "name",
            "attributes": {
                "name": "Name",
                "type": "text",
                "options": []
            },
            "links": {
                "self": "/field/name"
            }
        },
        {
            "type": "field",
            "id": "phone",
            "attributes": {
                "name": "Phone",
                "type": "phone",
                "options": []
            },
            "links": {
                "self": "/field/phone"
            }
        },
        {
            "type": "field",
            "id": "email",
            "attributes": {
                "name": "E-mail",
                "type": "email",
                "options": []
            },
            "links": {
                "self": "/field/email"
            }
        },
        {
            "type": "field",
            "id": "state",
            "attributes": {
                "name": "State",
                "type": "option",
                "options": {
                    "1": {
                        "name": "Alabama",
                        "abbreviation": "AL"
                    },
                    "2": {
                        "name": "Alaska",
                        "abbreviation": "AK"
                    },
                    "3": {
                        "name": "Arizona",
                        "abbreviation": "AZ"
                    },
                    "4": {
                        "name": "Arkansas",
                        "abbreviation": "AR"
                    },
                    "5": {
                        "name": "California",
                        "abbreviation": "CA"
                    },
                    "6": {
                        "name": "Colorado",
                        "abbreviation": "CO"
                    },
                    "7": {
                        "name": "Connecticut",
                        "abbreviation": "CT"
                    },
                    "8": {
                        "name": "Delaware",
                        "abbreviation": "DE"
                    },
                    "9": {
                        "name": "District of Columbia",
                        "abbreviation": "DC"
                    },
                    "10": {
                        "name": "Florida",
                        "abbreviation": "FL"
                    },
                    "11": {
                        "name": "Georgia",
                        "abbreviation": "GA"
                    },
                    "12": {
                        "name": "Hawaii",
                        "abbreviation": "HI"
                    },
                    "13": {
                        "name": "Idaho",
                        "abbreviation": "ID"
                    },
                    "14": {
                        "name": "Illinois",
                        "abbreviation": "IL"
                    },
                    "15": {
                        "name": "Indiana",
                        "abbreviation": "IN"
                    },
                    "16": {
                        "name": "Iowa",
                        "abbreviation": "IA"
                    },
                    "17": {
                        "name": "Kansas",
                        "abbreviation": "KS"
                    },
                    "18": {
                        "name": "Kentucky",
                        "abbreviation": "KY"
                    },
                    "19": {
                        "name": "Louisiana",
                        "abbreviation": "LA"
                    },
                    "20": {
                        "name": "Maine",
                        "abbreviation": "ME"
                    },
                    "21": {
                        "name": "Maryland",
                        "abbreviation": "MD"
                    },
                    "22": {
                        "name": "Massachusetts",
                        "abbreviation": "MA"
                    },
                    "23": {
                        "name": "Michigan",
                        "abbreviation": "MI"
                    },
                    "24": {
                        "name": "Minnesota",
                        "abbreviation": "MN"
                    },
                    "25": {
                        "name": "Mississippi",
                        "abbreviation": "MS"
                    },
                    "26": {
                        "name": "Missouri",
                        "abbreviation": "MO"
                    },
                    "27": {
                        "name": "Montana",
                        "abbreviation": "MT"
                    },
                    "28": {
                        "name": "Nebraska",
                        "abbreviation": "NE"
                    },
                    "29": {
                        "name": "Nevada",
                        "abbreviation": "NV"
                    },
                    "30": {
                        "name": "New Hampshire",
                        "abbreviation": "NH"
                    },
                    "31": {
                        "name": "New Jersey",
                        "abbreviation": "NJ"
                    },
                    "32": {
                        "name": "New Mexico",
                        "abbreviation": "NM"
                    },
                    "33": {
                        "name": "New York",
                        "abbreviation": "NY"
                    },
                    "34": {
                        "name": "North Carolina",
                        "abbreviation": "NC"
                    },
                    "35": {
                        "name": "North Dakota",
                        "abbreviation": "ND"
                    },
                    "36": {
                        "name": "Ohio",
                        "abbreviation": "OH"
                    },
                    "37": {
                        "name": "Oklahoma",
                        "abbreviation": "OK"
                    },
                    "38": {
                        "name": "Oregon",
                        "abbreviation": "OR"
                    },
                    "39": {
                        "name": "Pennsylvania",
                        "abbreviation": "PA"
                    },
                    "40": {
                        "name": "Puerto Rico",
                        "abbreviation": "PR"
                    },
                    "41": {
                        "name": "Rhode Island",
                        "abbreviation": "RI"
                    },
                    "42": {
                        "name": "South Carolina",
                        "abbreviation": "SC"
                    },
                    "43": {
                        "name": "South Dakota",
                        "abbreviation": "SD"
                    },
                    "44": {
                        "name": "Tennessee",
                        "abbreviation": "TN"
                    },
                    "45": {
                        "name": "Texas",
                        "abbreviation": "TX"
                    },
                    "46": {
                        "name": "Utah",
                        "abbreviation": "UT"
                    },
                    "47": {
                        "name": "Vermont",
                        "abbreviation": "VT"
                    },
                    "48": {
                        "name": "Virginia",
                        "abbreviation": "VA"
                    },
                    "49": {
                        "name": "Washington",
                        "abbreviation": "WA"
                    },
                    "50": {
                        "name": "West Virginia",
                        "abbreviation": "WV"
                    },
                    "51": {
                        "name": "Wisconsin",
                        "abbreviation": "WI"
                    },
                    "52": {
                        "name": "Wyoming",
                        "abbreviation": "WY"
                    }
                }
            },
            "links": {
                "self": "/field/state"
            }
        }
    ]
}

# Requirements

If scholarship has requirements you MUST to get requirement UID in order to apply for the scholarship.

GET /api/scholarship/@id/requirements or add ?include=requirements to scholarship item request.

{
    "data": [
        {
            "type": "scholarship_requirement",
            "id": "1230",
            "attributes": {
                "title": "dasf",
                "optional": false,
                "permanentId": 621,
                "description": "asdfasfasfd",
                "config": []
            },
            "links": {
                "self": "/scholarship_requirement/1230"
            },
            "relationships": {
                "requirement": {
                    "links": {
                        "self": "/scholarship_requirement/1230/relationships/requirement",
                        "related": "/scholarship_requirement/1230/requirement"
                    },
                    "data": {
                        "type": "requirement",
                        "id": "essay"
                    }
                }
            }
        }
    ],
    "included": [
        {
            "type": "requirement",
            "id": "essay",
            "attributes": {
                "type": "text",
                "name": "Essay"
            },
            "links": {
                "self": "/requirement/essay"
            }
        }
    ]
}

# Apply

We can apply to a scholarship with this API.

Each scholarship may require a different students' profile data. So, each scholarship has its own required fields configurations. Scholarship fields can be fetched via fields relation at API Scholarship Show action.

After we verified that we have all student's profile data, we can send the next request and apply for a scholarship.

# Attributes

List of attributes required for scholarship application is dynamic. It depends on Scholarship Fields and Scholarship Requirements, as configured on scholarship.

  • {fieldId} - Dynamic field ID received from relationships.fields[].field.id field.

    • In case of field type text, email, phone data must be string
    • In case of field type date data must have date format ( Example: 1989-02-17 )
    • In case of option type option value should be sent.
    • In case of multiple options, comma separated values must be sent.
  • requirements - List of requirement data received from scholarship details

    • {scholarshipRequirementId} - Scholarship requirement ID got from scholarship detail relationships.requirements[].id field.

      Requirement data depends on relationships.requirements[].requirement.type.

      • In case requirement type is text, input or link data should be sent as string
      • In case requirement type is file or image must be sent as file data
  • source - application source ( website, mobile application, web application, etc ) string max 255 Default: none

# Request example

POST /api/scholarship/@id/apply

{
	"data": {
		"attributes": {
			"name": "test name",
			"email": "asdfadasfjjkjkj@fasdfsdf.com",
			"phone": "+1 (123) 384-3939",
			"state": "1"
		}
	}
}

# Java Script form example

If a scholarship has file or image requirements we can't send them as JSON. We must send it as "multipart/form-data".

// Create new form
var form = new FormData();

// Set fields data
form.append('data[attributes][name]', 'Full name');
form.append('data[attributes][email]', 'email@dot.me');
form.append('data[attributes][phone]', '+1 111 111111');

// Set requirements data
form.append('data[attributes][requirements][781]', 'Text inputed by user');
form.append('data[attributes][requirements][782]', files[0]);

# Response

Success response will be in Application show format.

{
  "data": {
    "attributes": {
      "name": "Full name",
      "email": "email@dot.me",
      "phone": "+1 111 111111",
      "state": "1",
      "requirements": {
        "781": "Inputed text by user",
        "782": "http://sent.link.example",
        "783": "4849-39474-9393",
      },
      "source": "barn"
    },
  }
}