Skip to content
David Anastasio edited this page Dec 16, 2021 · 40 revisions

The API is a work in progress. It's fairly thorough and should be ready for production, but it isn't well tested. Please let me know if you encounter any issues.

Tokens

Token generation and authentication is handled by JetStream. Once enabled, users can create their own tokens on the "API Tokens" page, which is located in the top right dropdown menu.

Endpoints

This page details the API end points and gives examples for how to call them. All end points are authenticated.

Items

Get all items belonging to current user

HTTP Request

GET /api/v1/items

Payload

None

Response
{
  "availability_warning": false,
  "items": [
    {
      "id": 1,
      "name": "The Big Lebowski",
      "description": "Yeah, well, that's just like, uh, your opinion, man",
      "url": "https://www.amazon.com/Big-Lebowski-Blu-ray-Jeff-Bridges/dp/B07G2CJLNN/ref=sr_1_1?dchild=1&keywords=the+big+lebowski&qid=1635945322&qsid=130-3526940-1665363&sr=8-1&sres=B07G2CJLNN%2CB01MRHZM0G%2CB0089ATC2K%2C1531901816%2CB0000B1OGV%2CB002IAIC0U%2CB0002W19S8%2CB077HP8V44%2CB0053CANNY%2CB00D6M8HR2%2CB076WZQ1KQ%2CB000M06GS8%2CB07G1XX3MM%2C1531904343%2C1985135329%2CB01578RC5A&srpt=DOWNLOADABLE_MOVIE",
      "owner_id": "1",
      "claimed": true,
      "claimant_id": "2",
      "image_url": "https://images-na.ssl-images-amazon.com/images/I/51f04ukq6JL._SX300_SY300_QL70_ML2_.jpg",
      "created_at": "2021-10-31T14:48:25.000000Z",
      "updated_at": "2021-11-03T14:06:03.000000Z",
      "deleted_at": null,
      "purchased": null,
      "purchsed": null
    }
  ]
}

Notes

None


Create new Item

HTTP Request

POST /api/v1/items

Payload
{
  "name": "The White Donkey",
  "url": "https://www.amazon.com/White-Donkey-Terminal-Lance/dp/0316362832/ref=sr_1_1?keywords=the+white+donkey&qid=1638976129&sr=8-1",
  "description": "It's a graphic novel"
}
Response
{
  "message": "Item added"
}

Notes

URL and Description are optional


Update an Item

HTTP Request

PUT /api/v1/items/{item_id}

Payload
{
  "name": "The White Donkey",
  "url": "https://www.amazon.com/White-Donkey-Terminal-Lance/dp/0316362832/ref=sr_1_1?keywords=the+white+donkey&qid=1638976129&sr=8-1",
  "description": "It's a graphic novel"
}
Response
{
  "message": "Item updated"
}

Notes

URL and Description are optional


Delete an Item

HTTP Request

DELETE /api/v1/items

Payload
{
  "id": 12
}
Response
{
  "message": "Item Deleted"
}

Notes

None


Shares

Get all share information for current user

HTTP Request

GET /api/v1/shares

Payload

None

Response
{
  "shared_with_others": [
    {
      "id": 5,
      "owner_id": "1",
      "sharee_id": "2",
      "created_at": "2021-10-31T14:55:05.000000Z",
      "updated_at": "2021-11-17T16:21:35.000000Z",
      "deleted_at": "2021-11-17T16:21:35.000000Z",
      "sharee": {
        "id": 2,
        "name": "Dummy User",
        "email": "[email protected]",
        "current_team_id": null,
        "profile_photo_path": null,
        "deleted_at": null,
        "profile_photo_url": "https://ui-avatars.com/api/?name=Dummy+User&color=7F9CF5&background=EBF4FF"
      }
    }
  ],
  "shared_with_me": [
    {
      "id": 6,
      "owner_id": "2",
      "sharee_id": "1",
      "created_at": "2021-11-03T14:38:36.000000Z",
      "updated_at": "2021-11-03T14:38:36.000000Z",
      "deleted_at": null,
      "owner": {
        "id": 2,
        "name": "Dummy User",
        "email": "[email protected]",
        "current_team_id": null,
        "profile_photo_path": null,
        "deleted_at": null,
        "profile_photo_url": "https://ui-avatars.com/api/?name=Dummy+User&color=7F9CF5&background=EBF4FF"
      }
    }
  ]
}

Notes

URL and Description are optional


Create a Share

HTTP Request

PUT /api/v1/shares

Payload
{
  "email": "[email protected]"
}
Response
{
  "message": "Share Created"
}

Notes

email is the email of the person you are attempting to create a share with.


Delete a Share

HTTP Request

DELETE /api/v1/shares

Payload
{
  "id": 12
}
Response
{
  "message": "List revoked from user"
}

Notes

ID is the ID of the share you are attempting to destroy.

Claims

Get all items claimed by user

HTTP Request GET /api/v1/claims

Payload

None

Response ```json [ { "id": 6, "owner_id": "2", "sharee_id": "1", "created_at": "2021-11-03T14:38:36.000000Z", "updated_at": "2021-11-03T14:38:36.000000Z", "deleted_at": null, "owner": { "id": 2, "name": "Dummy User", "email": "[email protected]", "current_team_id": null, "profile_photo_path": null, "deleted_at": null, "profile_photo_url": "https://ui-avatars.com/api/?name=Dummy+User&color=7F9CF5&background=EBF4FF" }, "items": [ { "id": 7, "name": "test item", "description": null, "url": "https://google.com", "owner_id": "2", "claimed": true, "claimant_id": "1", "image_url": null, "created_at": "2021-11-12T15:39:32.000000Z", "updated_at": "2021-11-24T16:27:28.000000Z", "deleted_at": null, "purchased": "0", "purchsed": null, "laravel_through_key": "2" } ] } ] ```

Notes

None


Claim an Item

HTTP Request

POST /api/v1/claims

Payload
{
  "item_id": 12
}
Response
{
  "message": "Item Claimed"
}

Notes

None

Unclaim an Item

HTTP Request

DELETE /api/v1/claims

Payload
{
  "item_id": 12
}
Response
{
  "message": "Item Unclaimed"
}

Notes

None