Media


Search

Search for media.

Endpoint

Method URI Description
GET /users/{user_id}/media Search user owned media

Example Response

{
    "data": [
        {
            "id": 1,
            "name": "MediaName",
            "file_name": "filename_202005011450.csv",
            "collection_name": "exports",
            "mime_type": "text/plain",
            "size": 692804,
            "readable_size": "676.57 KB",
            "full_url": "https://example.com/file.csv",
            "download_url": "https://api.happygrasshopper.com/download/9ca02d21-3f75-42e7-1234-29b61bc283e5",
            "created_at": "2020-05-01T14:50:30Z",
            "updated_at": "2020-05-01T14:50:30Z",
            "deleted_at": null
        }
    ],
    "links": {
        "first": "http://api.happygrasshopper.com/v3/users/77179/media?page=1",
        "last": "http://api.happygrasshopper.com/v3/users/77179/media?page=5",
        "prev": null,
        "next": "http://api.happygrasshopper.com/v3/users/77179/media?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 5,
        "path": "http://api.happygrasshopper.com/v3/users/77179/media",
        "per_page": 15,
        "to": 15,
        "total": 66
    }
}

Create

Create media.

Endpoint

Method URI Description
POST /users/{user_id}/media Create a user media

Body Params

{
    "name": "MediaName",
    "file_name": "filename_202005011450.csv",
    "collection_name": "exports",
    "full_url": "https://example.com/file.csv",
}

Example Response

{
    "id": 1,
    "name": "MediaName",
    "file_name": "filename_202005011450.csv",
    "collection_name": "exports",
    "mime_type": "text/plain",
    "size": 692804,
    "readable_size": "676.57 KB",
    "full_url": "https://example.com/file.csv",
    "download_url": "https://api.happygrasshopper.com/download/9ca02d21-3f75-42e7-1234-29b61bc283e5",
    "created_at": "2020-05-01T14:50:30Z",
    "updated_at": "2020-05-01T14:50:30Z",
    "deleted_at": null
}

Read

Retrieve media.

Endpoint

Method URI Description
GET /media/{media_id} Retrieve media by it's id

Example Response

{
    "id": 1,
    "name": "MediaName",
    "file_name": "filename_202005011450.csv",
    "collection_name": "exports",
    "mime_type": "text/plain",
    "size": 692804,
    "readable_size": "676.57 KB",
    "full_url": "https://example.com/file.csv",
    "download_url": "https://api.happygrasshopper.com/download/9ca02d21-3f75-42e7-1234-29b61bc283e5",
    "created_at": "2020-05-01T14:50:30Z",
    "updated_at": "2020-05-01T14:50:30Z",
    "deleted_at": null
}

Delete

Delete media.

Endpoint

Method URI Description
DELETE /media/{media_id} Delete media by it's id

Example Response

{
    "success": true
}