Fabman

class fabman.Fabman(access_token: str, base_url='https://fabman.io/api/v1')

The main class to be instantiated to provide access to the Fabman api.

Initializes the Fabman class with the given access token and base url. All methods take kwargs as their arguments, please refer to the Fabman API for more information

Parameters:
  • access_token (str) – The access token to use for the API

  • (optional) (base_url) – The base url to use for the API

create_api_key(**kwargs) ApiKey

Creates a new API key for a member.

Calls:

“POST /api-keys” <https://fabman.io/api/v1/documentation#/api-keys/postApikeys>

Returns:

ApiKey object if successful

Return type:

fabman.ApiKey

create_booking(**kwargs) Booking

Creates a new booking in the Fabman database.

Calls:

“POST /bookings” <https://fabman.io/api/v1/documentation#/bookings/postBookings>

Returns:

Booking object if successful

Return type:

fabman.Booking

create_charge(**kwargs) Charge

Creates a new charge in the Fabman database.

Calls:

“POST /charges” <https://fabman.io/api/v1/documentation#/charges/postCharges>

Returns:

Charge object if successful

Return type:

fabman.Charge

create_invoice(**kwargs) Invoice

Creates a new invoice in the Fabman database.

Calls:

“POST /invoices” <https://fabman.io/api/v1/documentation#/invoices/postInvoices>

Returns:

Invoice object if successful

Return type:

fabman.Invoice

create_key_assignment(**kwargs) Response

Creates a new keycard assignment in the Fabman Database. Note: A better method to work with key assignments is to use the Member class and the associated MemberKey class that works with the key assignments endpoint.

Calls:

“POST /key-assignments” <https://fabman.io/api/v1/documentation#/key-assignments/postKeyassignments>

Returns:

requests.Response object if successful

Return type:

requests.Response

create_member(**kwargs) Member

Creates a new member in the Fabman database.

Calls:

“POST /members” <https://fabman.io/api/v1/documentation#/members/postMembers>

Returns:

Member object if successful

Return type:

fabman.Member

create_package(**kwargs) Package

Creates a new package in the Fabman database.

Calls:

“POST /packages” <https://fabman.io/api/v1/documentation#/packages/postPackages>

Returns:

Package object if successful

Return type:

fabman.Package

create_payment(**kwargs) Payment

Creates a new payment in the Fabman database.

Calls:

“POST /payments” <https://fabman.io/api/v1/documentation#/payments/postPayments>

Returns:

Payment object if successful

Return type:

fabman.Payment

create_resource(**kwargs) Resource

Creates a new resource in the Fabman database.

Calls:

“POST /resources” <https://fabman.io/api/v1/documentation#/resources/postResources>

Returns:

Resource object if successful

Return type:

fabman.Resource

create_resource_log(**kwargs) ResourceLog

Creates a new resource log in the Fabman database. Use with caution.

Calls:

“POST /resource-logs” <https://fabman.io/api/v1/documentation#/resource-logs/postResourcelogs>

Returns:

ResourceLog object if successful

Return type:

fabman.ResourceLog

create_resource_type(**kwargs) ResourceType

Creates a new resource type in the Fabman database.

Calls:

“POST /resource-types” <https://fabman.io/api/v1/documentation#/resource-types/postResourcetypes>

Returns:

ResourceType object if successful

Return type:

fabman.ResourceType

create_space(**kwargs) Space

Creates a new space in the Fabman database.

Calls:

“POST /spaces” <https://fabman.io/api/v1/documentation#/spaces/postSpaces>

Returns:

Space object if successful

Return type:

fabman.Space

create_training_course(**kwargs) TrainingCourse

Creates a new Training course in the Fabman database.

Calls:

“POST /training-courses” <https://fabman.io/api/v1/documentation#/training-courses/postTrainingcourses>

Returns:

TrainingCourse object if successful

Return type:

fabman.TrainingCourse

create_webhook(**kwargs) Webhook

Creates a new webhook in the Fabman database.

Calls:

“POST /webhooks” <https://fabman.io/api/v1/documentation#/webhooks/postWebhooks>

Returns:

Webhook object if successful

Return type:

fabman.Webhook

get_account(account_id, **kwargs) Account

Get a single account by its ID. Note: for most users, the only account retrievable is the account of the API key holder. Majority of endpoints are not implemented as they require superuser privileges.

Calls:

“GET /accounts/{account_id}” <https://fabman.io/api/v1/documentation#/accounts/getAccountsId>

Parameters:

account_id (int) – The id of the account to retrieve

Returns:

Account object if successful

Return type:

fabman.Account

get_accounts(**kwargs) PaginatedList

Get a list of accounts. Note, for most users this will only return the account of the API key holder. Most documented endpoints are unimplemented as a result.

Calls:

“GET /accounts” <https://fabman.io/api/v1/documentation#/accounts/getAccounts>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_api_key(key_id, **kwargs) ApiKey

Get information about a single API key by its ID.

Calls:

“GET /api-keys/{key_id}” <https://fabman.io/api/v1/documentation#/api-keys/getApikeysId>

Parameters:

key_id (int) – The id of the API key to retrieve

Returns:

ApiKey object if successful

Return type:

fabman.ApiKey

get_api_keys(**kwargs) PaginatedList

Get a list of API keys. Can specify filters, search string, etc.

Calls:

“GET /api-keys” <https://fabman.io/api/v1/documentation#/api-keys/getApikeys>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_booking(booking_id, **kwargs) Booking

Get a single booking by its ID.

Calls:

“GET /bookings/{id}” <https://fabman.io/api/v1/documentation#/bookings/getBookingsId>

Parameters:

booking_id (int) – The id of the booking to retrieve

Returns:

Booking object if successful

Return type:

fabman.Booking

get_bookings(**kwargs) PaginatedList

Retrieves a PaginatedList of bookings from the API. Can specify filters, search string, etc.

Calls:

“GET /bookings” <https://fabman.io/api/v1/documentation#/bookings/getBookings>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_charge(charge_id: int, **kwargs) Charge

Retrieves a single Charge given the charge_id.

Calls:

“Get /charges/{id}” <https://fabman.io/api/v1/documentation#/charges/getChargesId>

Parameters:

charge_id (int) – The id of the charge to retrieve

Returns:

Charge object if successful

Return type:

fabman.Charge

get_charges(**kwargs) PaginatedList

Retrieves all charges from the API. Can specify filters, search string, etc.

Calls:

“GET /charges” <https://fabman.io/api/v1/documentation#/charges/getCharges>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_invoice(invoice_id, **kwargs) Invoice

Retrieve information of a single invoice by its ID.

Calls:

“GET /invoices/{id}” <https://fabman.io/api/v1/documentation#/invoices/getInvoicesId>

Parameters:

invoice_id (int) – The id of the invoice to retrieve

Returns:

Invoice object if successful

Return type:

fabman.Invoice

get_invoices(**kwargs) PaginatedList

Retrieves list of all invoices. Can specify filters, search string, etc.

Calls:

“GET /invoices” <https://fabman.io/api/v1/documentation#/invoices/getInvoices>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_job(job_id, **kwargs) Job

Retrieve a single job from the Fabman API given the job_id.

Calls:

“GET /jobs/{id}” <https://fabman.io/api/v1/documentation#/jobs/getJobsId>

Parameters:

job_id (int) – The id of the job to retrieve

Returns:

Job object if successful

Return type:

Job

get_jobs(**kwargs) PaginatedList

Retrieves a list of all jobs. Can specify filters, search string, etc.

Calls:

“GET /jobs” <https://fabman.io/api/v1/documentation#/jobs/getJobs>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_member(member_id: int, **kwargs)

Retrieves a member from the API give their id :calls: “GET /members/{id}” <https://fabman.io/api/v1/documentation#/members/getMembersId>

Parameters:

member_id (int) – The id of the member to retrieve

Returns:

Member object if successful

get_members(**kwargs)

Get all of the members in the Fabman database. Can specify filters, search string, result limits, offsets, and sorting. Refer to the Fabman API documentation.

Calls:

“GET /members” <https://fabman.io/api/v1/documentation#/members/getMembers>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_package(package_id: int, **kwargs) Package

Retrieves a single Package given a package_id

Calls:

“GET /packages/{id}” <https://fabman.io/api/v1/documentation#/packages/getPackagesId>

Parameters:

package_id (int) – The id of the package to retrieve

Returns:

Package object if successful

Return type:

fabman.Package

get_packages(**kwargs) PaginatedList

Retrieves a list of packages. Can specify filters, search string, etc.

Calls:

“GET /packages” <https://fabman.io/api/v1/documentation#/packages/getPackages>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_payment(payment_id, **kwargs) Payment

Retrieves a single payment given a payment_id.

Calls:

“GET /payments/{id}” <https://fabman.io/api/v1/documentation#/payments/getPaymentsId>

Parameters:

payment_id (int) – The id of the payment to retrieve

Returns:

Payment object if successful

Return type:

fabman.Payment

get_payments(**kwargs) PaginatedList

Retrieves a list of payments. Can specify filters, search string, etc.

Calls:

“GET /payments” <https://fabman.io/api/v1/documentation#/payments/getPayments>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_resource(resource_id: int, **kwargs)

Get a single resource by its ID. Embed information is also available.

Calls:

“GET /resources/{id}” <https://fabman.io/api/v1/documentation#/resources/getResourcesId>

Parameters:

resource_id (int) – The id of the resource to retrieve

Returns:

Resource object if successful

Return type:

fabman.Resource

get_resource_log(resource_log_id, **kwargs) ResourceLog

Retrieves a single Resource Log from the API.

Calls:

“GET /resource-logs/{id}” <https://fabman.io/api/v1/documentation#/resource-logs/getResourcelogsId>

Parameters:

resource_log_id (int) – The id of the resource log to retrieve

Returns:

ResourceLog object if successful

Return type:

fabman.ResourceLog

get_resource_logs(**kwargs) PaginatedList

Retrieves a list of resource logs. Can specify filters, search string, etc.

Calls:

“GET /resource-logs” <https://fabman.io/api/v1/documentation#/resource-logs/getResourcelogs>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_resource_types(**kwargs) PaginatedList

Retrieves a list of resource types. Can specify filters, search string, etc.

Calls:

“GET /resource-types” <https://fabman.io/api/v1/documentation#/resource-types/getResourcetypes>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_resources(**kwargs) PaginatedList

Get list of available resources (e.g. doors, printers, etc.) Limit, offset, and a number of filters are available. Refer to the appropriate documentation.

Calls:

“GET /resources” <https://fabman.io/api/v1/documentation#/resources/getResources>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_space(space_id, **kwargs) Space

Retrieves a single space given a space_id.

Calls:

“GET /spaces/{id}” <https://fabman.io/api/v1/documentation#/spaces/getSpacesId>

Parameters:

space_id (int) – The id of the space to retrieve

Returns:

Space object if successful

Return type:

fabman.Space

get_spaces(**kwargs) PaginatedList

Retrieves a list of Spaces. Can specify filters, search string, etc.

Calls:

“GET /spaces” <https://fabman.io/api/v1/documentation#/spaces/getSpaces>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_training_course(course_id, **kwargs)

Retrieve a single TrainingCourse object from the API.

Calls:

“GET /training-courses/{id}” <https://fabman.io/api/v1/documentation#/training-courses/getTrainingcoursesId>

Parameters:

course_id (int) – The id of the training course to retrieve

Returns:

TrainingCourse object if successful

Return type:

fabman.TrainingCourse

get_training_courses(**kwargs)

Retrieves a PaginatedList of Training Courses available on the api.

Calls:

“GET /training-courses” <https://fabman.io/api/v1/documentation#/training-courses/getTrainingcourses>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList

get_user(**kwargs) Member

Gets authenticated user information from the API as Member object. Does not returns state and superuser information. :calls: “GET /user/me” <https://fabman.io/api/v1/documentation#/user/getUserMe>

Returns:

Member object if successful

Return type:

fabman.Member

get_webhook(webhook_id, **kwargs) Webhook

Retrieves a single webhook given a webhook_id.

Calls:

“GET /webhooks/{id}” <https://fabman.io/api/v1/documentation#/webhooks/getWebhooksId>

Parameters:

webhook_id (int) – The id of the webhook to retrieve

Returns:

Webhook object if successful

Return type:

fabman.Webhook

get_webhooks(**kwargs) PaginatedList

Retrieves a list of webhooks. Can specify filters, search string, etc.

Calls:

“GET /webhooks” <https://fabman.io/api/v1/documentation#/webhooks/getWebhooks>

Returns:

PaginatedList object if successful

Return type:

fabman.PaginatedList