NAV
shell ruby python csharp php

File

The File object

The File object looks like this in JSON:

{
    "object": "file",
    "id": 1,
    "file_data_id": 2,
    "name": "profile1.jpg",
    "alt": null,
    "contenttype": null,
    "size": 16814,
    "added_to": 1,
    "filename": null,
    "status": "active",
    "trashed_by_id": null,
    "type": "PROFILE_PICTURE",
    "mime_type": "image\/jpeg",
    "media_type": null,
    "encoding_status": null,
    "added_at": "2022-08-01T23:19:44+00:00",
    "added_by_id": 1,
    "sandbox": true
}
Attribute Required Data Type
id Yes int
file_data_id Yes int
name Yes text (255)
alt No text (1000)
contenttype Yes text (255)
size Yes int
added_to Yes int
filename No text (255)
status Yes enum (uploading, active, deleted)
trashed_by_id No int
type No text
mime_type No text
media_type No text
encoding_status No text
added_at No datetime
added_by_id No int
sandbox No bool

index (courselesson)

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files',
 headers={
  'Authorization': 'Bearer YOUR_POPULI_API_KEY'
 },
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);

Example response:

{
    "object": "list",
    "count": 1,
    "results": 1,
    "results_per_page": null,
    "pages": 1,
    "page": 1,
    "offset": 0,
    "has_more": false,
    "data": [
        {
            "object": "file",
            "id": 4,
            "file_data_id": 2,
            "name": "lesson_file.pdf",
            "alt": null,
            "contenttype": null,
            "size": 16814,
            "added_to": 3,
            "filename": null,
            "status": "active",
            "trashed_by_id": null,
            "type": "LESSON",
            "mime_type": "image\/jpeg",
            "media_type": null,
            "encoding_status": null,
            "added_at": "2022-08-01T23:19:44+00:00",
            "added_by_id": 1
        }
    ],
    "sandbox": true
}

Retrieves all File objects tied to a specific Courseoffering.

HTTP Request

GET /courseofferings/(courseoffering)/lessons/(courselesson)/files

Parameters

None

Permissions

One of the following roles is required to call this method:

index (courseoffering)

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files',
 headers={
  'Authorization': 'Bearer YOUR_POPULI_API_KEY'
 },
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);

Example response:

{
    "object": "list",
    "count": 1,
    "results": 1,
    "results_per_page": null,
    "pages": 1,
    "page": 1,
    "offset": 0,
    "has_more": false,
    "data": [
        {
            "object": "file",
            "id": 2,
            "file_data_id": 2,
            "name": "course_handouts.pdf",
            "alt": null,
            "contenttype": null,
            "size": 16814,
            "added_to": 21908,
            "filename": null,
            "status": "active",
            "trashed_by_id": null,
            "type": "COURSE",
            "mime_type": "image\/jpeg",
            "media_type": null,
            "encoding_status": null,
            "added_at": "2022-08-01T23:19:44+00:00",
            "added_by_id": 1
        }
    ],
    "sandbox": true
}

Retrieves all File objects tied to a specific Courseoffering.

HTTP Request

GET /courseofferings/(courseoffering)/files

Parameters

None

Permissions

One of the following roles is required to call this method:

show (courseoffering)

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files/(file)" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files/(file)',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files/(file)',
 headers={
  'Authorization': 'Bearer YOUR_POPULI_API_KEY'
 },
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files/(file)"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/files/(file)');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);

Example response:

{
    "object": "file",
    "id": 2,
    "file_data_id": 2,
    "name": "course_handouts.pdf",
    "alt": null,
    "contenttype": null,
    "size": 16814,
    "added_to": 21908,
    "filename": null,
    "status": "active",
    "trashed_by_id": null,
    "type": "COURSE",
    "mime_type": "image\/jpeg",
    "media_type": null,
    "encoding_status": null,
    "added_at": "2022-08-01T23:19:44+00:00",
    "added_by_id": 1,
    "sandbox": true
}

Retrieves a specific File object.

HTTP Request

GET /courseofferings/(courseoffering)/files/(file)

Parameters

No additional parameters are needed beyond the ID of the object being requested that appears in the URL.

Permissions

One of the following roles is required to call this method:

show (courselesson)

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files/(file)" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files/(file)',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files/(file)',
 headers={
  'Authorization': 'Bearer YOUR_POPULI_API_KEY'
 },
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files/(file)"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/courseofferings/(courseoffering)/lessons/(courselesson)/files/(file)');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);

Example response:

{
    "object": "file",
    "id": 4,
    "file_data_id": 2,
    "name": "lesson_file.pdf",
    "alt": null,
    "contenttype": null,
    "size": 16814,
    "added_to": 3,
    "filename": null,
    "status": "active",
    "trashed_by_id": null,
    "type": "LESSON",
    "mime_type": "image\/jpeg",
    "media_type": null,
    "encoding_status": null,
    "added_at": "2022-08-01T23:19:44+00:00",
    "added_by_id": 1,
    "sandbox": true
}

Retrieves a specific File object.

HTTP Request

GET /courseofferings/(courseoffering)/lessons/(courselesson)/files/(file)

Parameters

No additional parameters are needed beyond the ID of the object being requested that appears in the URL.

Permissions

One of the following roles is required to call this method:

show

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/files/(file)" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/files/(file)',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/files/(file)',
 headers={
  'Authorization': 'Bearer YOUR_POPULI_API_KEY'
 },
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/files/(file)"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/files/(file)');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);

Example response:

{
    "object": "file",
    "id": 1,
    "file_data_id": 2,
    "name": "profile1.jpg",
    "alt": null,
    "contenttype": null,
    "size": 16814,
    "added_to": 1,
    "filename": null,
    "status": "active",
    "trashed_by_id": null,
    "type": "PROFILE_PICTURE",
    "mime_type": "image\/jpeg",
    "media_type": null,
    "encoding_status": null,
    "added_at": "2022-08-01T23:19:44+00:00",
    "added_by_id": 1,
    "sandbox": true
}

Retrieves a specific File object.

HTTP Request

GET /files/(file)

Parameters

No additional parameters are needed beyond the ID of the object being requested that appears in the URL.

Expandable Properties

download

curl "https://yourschool.populiweb.com/api2/files/(file)/download" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/files/(file)/download',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/files/(file)/download',
 headers={
  'Authorization': 'Bearer YOUR_POPULI_API_KEY'
 },
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/files/(file)/download"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/files/(file)/download');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);

Example response:

{}

HTTP Request

GET /files/(file)/download

Parameters

None

Example code to call this method:

curl "https://yourschool.populiweb.com/api2/files/(file)/download_link" \
-H "Content-Type: application/json" \ 
-H "Authorization: Bearer YOUR_POPULI_API_KEY" \ 
-X GET
require 'httparty'
response = HTTParty.get(
 'https://yourschool.populiweb.com/api2/files/(file)/download_link',
 headers: {
  'Authorization' => 'Bearer YOUR_POPULI_API_KEY'
 },
)
puts response.body
import requests
response = requests.get(
 'https://yourschool.populiweb.com/api2/files/(file)/download_link',
 headers={
  'Authorization': 'Bearer YOUR_POPULI_API_KEY'
 },
)
print(response.json())
using Newtonsoft.Json;
using RestSharp;
var client = new RestClient();
var request = new RestRequest(new Uri("https://yourschool.populiweb.com/api2/files/(file)/download_link"), Method.Get);
request.AddHeader("Authorization", "Bearer YOUR_POPULI_API_KEY");
var response = client.Execute(request);
var response_object = JsonConvert.DeserializeObject(response.Content);
Console.Write(response_object);
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'https://yourschool.populiweb.com/api2/files/(file)/download_link');
curl_setopt($curl, CURLOPT_HTTPHEADER, ['Authorization: Bearer YOUR_POPULI_API_KEY']);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, 'GET');
$response = curl_exec($curl);
$response_decoded = json_decode($response);
var_dump($response_decoded);

Example response:

{
    "object": "file",
    "id": 1,
    "name": "profile1.jpg",
    "download_link": "https:\/\/s3.amazonaws.com\/dev.populi.co\/d069f5039d2e80a4edda7b6ba44a034f.jpg?AWSAccessKeyId=AKIAJGVEOZ7CAMYX2QDQ&Expires=1784997610&response-content-disposition=inline;%20filename=%22profile1.jpg%22&Signature=zPwPmEdp0aExx8SuGqXy2p424xU%3D"
}

HTTP Request

GET /files/(file)/download_link

Parameters

None