New FastAPI python page for easily human reading of the json objects we are capturing. Addition of a template parser that can be used to interpret and send/push jobMaterials to the server. Adding the docs dir just so that it is all together.
This commit is contained in:
@@ -0,0 +1,459 @@
|
||||
# Update a Job Material
|
||||
|
||||
|
||||
|
||||
#### OAuth Scope
|
||||
This endpoint requires the following OAuth scope **manage_job_materials**.
|
||||
|
||||
|
||||
|
||||
# OpenAPI definition
|
||||
|
||||
```json
|
||||
{
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "ServiceM8 API",
|
||||
"description": "Move your app forward with the ServiceM8 API\n\n\n\n## Limits and Throttling\nTo ensure continuous quality of service, API usage can be subject to throttling. The throttle will be applied once an API consumer reaches a certain \nthreshold in terms of a maximum number of requests per minute. Most clients will never hit this threshold, but those that do, will get met by a \nHTTP 429 Too Many Requests response code. \n \nThere is a limit of 180 requests per minute, if you reach this you will receive a HTTP 429 with a text body of \"Number of allowed API requests per minute exceeded\".\nThere is a limit of 20000 requests per day, if you reach this you will receive a HTTP 429 with a text body of \"Number of allowed API requests per day exceeded\".\n\nWe encourage all API developers to anticipate this error, and take appropriate measures like e.g. using a cached value from a previous call, or passing on a message to the end user that gets subjected to this behaviour (if any).\n\nLimits are per Addon per account.\n",
|
||||
"termsOfService": "https://www.servicem8.com/terms-of-service",
|
||||
"version": "1.0.0"
|
||||
},
|
||||
"servers": [
|
||||
{
|
||||
"url": "https://api.servicem8.com/api_1.0"
|
||||
}
|
||||
],
|
||||
"security": [
|
||||
{
|
||||
"apiKey": []
|
||||
},
|
||||
{
|
||||
"oauth2": []
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/jobmaterial/{uuid}.json": {
|
||||
"post": {
|
||||
"tags": [
|
||||
"Job Materials"
|
||||
],
|
||||
"operationId": "updateJobMaterials",
|
||||
"summary": "Update a Job Material",
|
||||
"description": "\n\t\t\t\n#### OAuth Scope\nThis endpoint requires the following OAuth scope **manage_job_materials**.\n\n\t\t\t",
|
||||
"security": [
|
||||
{
|
||||
"apiKey": []
|
||||
},
|
||||
{
|
||||
"oauth2": [
|
||||
"manage_job_materials"
|
||||
]
|
||||
}
|
||||
],
|
||||
"parameters": [
|
||||
{
|
||||
"name": "uuid",
|
||||
"in": "path",
|
||||
"description": "UUID of the Job Material",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"format": "uuid"
|
||||
}
|
||||
}
|
||||
],
|
||||
"requestBody": {
|
||||
"description": "Job Material fields to update",
|
||||
"required": true,
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/JobMaterialCreate"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Success - The record was updated successfully",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Result"
|
||||
},
|
||||
"examples": {
|
||||
"success": {
|
||||
"value": {
|
||||
"errorCode": "0",
|
||||
"message": "OK"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"400": {
|
||||
"description": "Bad Request - The request is malformed or contains invalid parameters",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
},
|
||||
"examples": {
|
||||
"badRequest": {
|
||||
"value": {
|
||||
"errorCode": "1000",
|
||||
"message": "An error occurred completing your request"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"401": {
|
||||
"description": "Unauthorized - Authentication credentials are missing or invalid",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/AuthenticationError"
|
||||
},
|
||||
"examples": {
|
||||
"unauthorized": {
|
||||
"value": {
|
||||
"errorCode": "401",
|
||||
"message": "Authentication failed. Please check your API key or OAuth token."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"403": {
|
||||
"description": "Forbidden - You don't have permission to update this resource",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/ForbiddenError"
|
||||
},
|
||||
"examples": {
|
||||
"forbidden": {
|
||||
"value": {
|
||||
"errorCode": "403",
|
||||
"message": "Access forbidden. You don't have permission to access this resource."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "Not Found - The record to update does not exist or has been deleted",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/NotFoundError"
|
||||
},
|
||||
"examples": {
|
||||
"notFound": {
|
||||
"value": {
|
||||
"errorCode": "404",
|
||||
"message": "Resource not found. The requested record does not exist or has been deleted."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"429": {
|
||||
"description": "Too Many Requests - You have exceeded the rate limit",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/RateLimitError"
|
||||
},
|
||||
"examples": {
|
||||
"rateLimitMinute": {
|
||||
"value": {
|
||||
"errorCode": 429,
|
||||
"message": "Number of allowed API requests per minute exceeded"
|
||||
}
|
||||
},
|
||||
"rateLimitDay": {
|
||||
"value": {
|
||||
"errorCode": 429,
|
||||
"message": "Number of allowed API requests per day exceeded"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"description": "Internal Server Error - An unexpected error occurred on the server",
|
||||
"content": {
|
||||
"application/json": {
|
||||
"schema": {
|
||||
"$ref": "#/components/schemas/Error"
|
||||
},
|
||||
"examples": {
|
||||
"serverError": {
|
||||
"value": {
|
||||
"errorCode": 500,
|
||||
"message": "An unexpected error occurred. Please try again later."
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"components": {
|
||||
"securitySchemes": {
|
||||
"apiKey": {
|
||||
"type": "apiKey",
|
||||
"name": "X-Api-Key",
|
||||
"in": "header"
|
||||
},
|
||||
"oauth2": {
|
||||
"type": "oauth2",
|
||||
"flows": {
|
||||
"authorizationCode": {
|
||||
"authorizationUrl": "https://api.servicem8.com/oauth/authorize",
|
||||
"tokenUrl": "https://api.servicem8.com/oauth/access_token",
|
||||
"scopes": {
|
||||
"staff_locations": "Access to real-time GPS information about staff",
|
||||
"staff_activity": "Access to clock on, lunch break and clock off information about staff",
|
||||
"publish_sms": "Access to send SMS messages to customers and/or staff on your behalf. Note sending SMS messages will incur account charges.",
|
||||
"publish_email": "Access to send Email messages to customers and/or staff on your behalf",
|
||||
"vendor": "Access to basic account information",
|
||||
"vendor_logo": "Access to account logo",
|
||||
"vendor_email": "Access to account holder email address",
|
||||
"read_locations": "Read-only access to Location Endpoint",
|
||||
"manage_locations": "Full access to Location Endpoint",
|
||||
"read_staff": "Read-only access to Staff Endpoint",
|
||||
"manage_staff": "Full access to Staff Endpoint",
|
||||
"read_customers": "Read-only access to Company Endpoint",
|
||||
"manage_customers": "Full access to Company Endpoint",
|
||||
"read_customer_contacts": "Read-only access to CompanyContact Endpoint",
|
||||
"manage_customer_contacts": "Full access to CompanyContact Endpoint",
|
||||
"read_jobs": "Read-only access to Job Endpoint",
|
||||
"manage_jobs": "Full access to Job Endpoint",
|
||||
"create_jobs": "Ability to create jobs on behalf of account. Note creating jobs may incur account charges.",
|
||||
"read_job_contacts": "Read-only access to JobContact Endpoint",
|
||||
"manage_job_contacts": "Full access to JobContact Endpoint",
|
||||
"read_job_materials": "Read-only access to JobMaterials Endpoint",
|
||||
"manage_job_materials": "Full access to JobMaterials Endpoint",
|
||||
"read_job_categories": "Read-only access to Categories Endpoint",
|
||||
"manage_job_categories": "Full access to Categories Endpoint",
|
||||
"read_job_queues": "Read-only access to Job Queues Endpoint",
|
||||
"manage_job_queues": "Full access to Job Queues Endpoint",
|
||||
"read_tasks": "Read-only access to Tasks Endpoint",
|
||||
"manage_tasks": "Full access to Tasks Endpoint",
|
||||
"read_schedule": "Read-only access to JobActivity Endpoint",
|
||||
"manage_schedule": "Full access to JobActivity Endpoint",
|
||||
"read_inventory": "Read-only access to Materials Endpoint",
|
||||
"manage_inventory": "Full access to Materials Endpoint",
|
||||
"read_job_notes": "Read-only access to job notes",
|
||||
"publish_job_notes": "Ability to add new job notes",
|
||||
"read_job_photos": "Read-only access to job photos",
|
||||
"publish_job_photos": "Ability to add new job photos",
|
||||
"read_attachments": "Read-only access to Attachments Endpoint",
|
||||
"manage_attachments": "Full access to Attachments Endpoint",
|
||||
"read_inbox": "Read-only access to inbox messages",
|
||||
"read_messages": "Read-only access to staff messages",
|
||||
"manage_notifications": "Ability to read notifications and mark as read",
|
||||
"manage_templates": "Full-access to email, sms and document templates",
|
||||
"manage_badges": "Full-access to create/modify job badges",
|
||||
"read_assets": "Read-only access to Assets Endpoint",
|
||||
"manage_assets": "Full access to Assets Endpoint",
|
||||
"read_knowledge_base": "Read-only access to Knowledge Base Endpoint",
|
||||
"manage_knowledge_base": "Full access to Knowledge Base Endpoint"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"schemas": {
|
||||
"Result": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errorCode": {
|
||||
"type": "number",
|
||||
"format": "int32",
|
||||
"example": "0"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "OK"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Error": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errorCode": {
|
||||
"type": "number",
|
||||
"format": "int32",
|
||||
"example": "1000"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "An error occurred completing your request"
|
||||
}
|
||||
}
|
||||
},
|
||||
"RateLimitError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errorCode": {
|
||||
"type": "number",
|
||||
"format": "int32",
|
||||
"example": "429"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "Number of allowed API requests per minute exceeded"
|
||||
}
|
||||
}
|
||||
},
|
||||
"AuthenticationError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errorCode": {
|
||||
"type": "number",
|
||||
"format": "int32",
|
||||
"example": "401"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "Authentication failed. Please check your API key or OAuth token."
|
||||
}
|
||||
}
|
||||
},
|
||||
"ForbiddenError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errorCode": {
|
||||
"type": "number",
|
||||
"format": "int32",
|
||||
"example": "403"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "Access forbidden. You don't have permission to access this resource."
|
||||
}
|
||||
}
|
||||
},
|
||||
"NotFoundError": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"errorCode": {
|
||||
"type": "number",
|
||||
"format": "int32",
|
||||
"example": "404"
|
||||
},
|
||||
"message": {
|
||||
"type": "string",
|
||||
"example": "Resource not found. The requested record does not exist or has been deleted."
|
||||
}
|
||||
}
|
||||
},
|
||||
"JobMaterialCreate": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"job_uuid": {
|
||||
"description": "The UUID of the job this material is associated with. This is a required field that establishes the relationship between the job material and its parent job.",
|
||||
"format": "uuid",
|
||||
"example": "123e4567-6110-4f36-93cc-23f94736b95b",
|
||||
"type": "string"
|
||||
},
|
||||
"material_uuid": {
|
||||
"description": "The UUID of the material catalog item this job material is based on. Links the job material to the corresponding material in the materials catalog.",
|
||||
"format": "uuid",
|
||||
"example": "123e4567-e645-4a4d-bb32-23f94a99a5ab",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"description": "The name of the material item used on the job. This is displayed on invoices and is used to identify the material to the customer. The name typically comes from the associated material object but can be customized per job.",
|
||||
"type": "string",
|
||||
"maxLength": 500
|
||||
},
|
||||
"quantity": {
|
||||
"description": "The quantity of this material used on the job. This field is mandatory and cannot be empty.",
|
||||
"type": "string",
|
||||
"maxLength": 100
|
||||
},
|
||||
"price": {
|
||||
"description": "The unit price of the material excluding tax. Used in calculations to determine the total price for this line item on the job. The system may automatically adjust this value to maintain consistency with tax-inclusive pricing.",
|
||||
"type": "string"
|
||||
},
|
||||
"displayed_amount": {
|
||||
"description": "The unit price amount as displayed on invoices and quotes. This can be either tax-inclusive or tax-exclusive depending on the displayed_amount_is_tax_inclusive field value. Used for presentation to customers.",
|
||||
"type": "string"
|
||||
},
|
||||
"displayed_amount_is_tax_inclusive": {
|
||||
"description": "Boolean flag indicating whether the displayed_amount includes tax (true) or excludes tax (false). This controls how prices are presented to customers and determines which price value (inclusive or exclusive) is used in calculations.",
|
||||
"type": "string"
|
||||
},
|
||||
"tax_rate_uuid": {
|
||||
"description": "The UUID of the tax rate applied to this job material. Determines how tax is calculated for this specific line item.",
|
||||
"format": "uuid",
|
||||
"example": "123e4567-1528-43e7-a99b-23f944dde9cb",
|
||||
"type": "string"
|
||||
},
|
||||
"sort_order": {
|
||||
"description": "Integer value controlling the display order of materials on a job. Lower values appear first in lists. Used to customize the presentation order of materials on quotes, invoices and job forms.",
|
||||
"type": "string"
|
||||
},
|
||||
"cost": {
|
||||
"description": "The cost of the material for this job. This is the ex-tax amount.",
|
||||
"type": "string"
|
||||
},
|
||||
"displayed_cost": {
|
||||
"description": "The cost of the material for this job, displayed as inc-tax or ex-tax depending on jobMaterial.displayed_amount_is_tax_inclusive.",
|
||||
"type": "string"
|
||||
},
|
||||
"uuid": {
|
||||
"format": "uuid",
|
||||
"description": "Unique identifier for this record",
|
||||
"example": "123e4567-59d5-48ed-8c3e-23f94642c1db",
|
||||
"type": "string"
|
||||
},
|
||||
"job_material_bundle_uuid": {
|
||||
"format": "uuid",
|
||||
"example": "123e4567-beac-430e-9edc-23f94068e49b",
|
||||
"type": "string",
|
||||
"description": "UUID of a JobMaterialBundle which this JobMaterial belongs to. The default value is blank, which means that the JobMaterial is not part of a JobMaterialBundle."
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"quantity"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"x-speakeasy-retries": {
|
||||
"strategy": "backoff",
|
||||
"backoff": {
|
||||
"initialInterval": 500,
|
||||
"maxInterval": 60000,
|
||||
"maxElapsedTime": 3600000,
|
||||
"exponent": 1.5
|
||||
},
|
||||
"statusCodes": [
|
||||
"5XX",
|
||||
"429"
|
||||
],
|
||||
"retryConnectionErrors": true
|
||||
},
|
||||
"tags": [
|
||||
{
|
||||
"name": "Job Materials",
|
||||
"description": "Operations related to Job Materials"
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user