Difference between revisions of "Get Job PDF"
(→Get Job PDF) |
m (→Usage / Caching) |
||
| (5 intermediate revisions by 2 users not shown) | |||
| Line 1: | Line 1: | ||
=== Get Job PDF === | === Get Job PDF === | ||
| − | The MyMobileWorkers web portal provides a tool for exporting PDFs from the job data | + | The MyMobileWorkers web portal provides a tool for exporting PDFs from the job data. In some integration cases it may be easier to pull the completed job down in PDF format than importing the data into your database. This call provides a way to remotely download the same PDFs the portal generates using your API key as authentication rather than having to log in via the web. Note however that options which may default to on on the portal likely default to off via the API. |
| − | '''The tool provided to do this is part of the web portal and not the api, as such the URL is slightly different.''' | + | '''The tool provided to do this is part of the web portal and not the api server, as such the URL is slightly different.''' |
| − | https:// | + | https://live.mymobileworkers.com/api/ |
| − | + | The coding style is similar to the main API and returns the same set of error codes. | |
== Summary == | == Summary == | ||
| Line 30: | Line 30: | ||
! | ! | ||
| export_name || not required | | export_name || not required | ||
| + | |- | ||
| + | ! | ||
| + | | show_photos (etc, see below for full list) || not required | ||
|- | |- | ||
! Response | ! Response | ||
| Line 47: | Line 50: | ||
== Usage / Caching == | == Usage / Caching == | ||
| − | Requesting PDFs via this tool can sometimes take an extended period to generate | + | Requesting PDFs via this tool can sometimes take an extended period to generate. It is suggested that any PDFs generated are not streamed directly to your end users but saved on your server for downloading. |
== Header / Footer == | == Header / Footer == | ||
| Line 66: | Line 69: | ||
Below is a list of optional extra GET parameters which are related specifically to this export type | Below is a list of optional extra GET parameters which are related specifically to this export type | ||
| + | Use a value of 1 for true (show the item) or 0 for false (do not show the item) | ||
| − | '''''Note: when sending get | + | '''''Note: when sending get parameters use the boolean value not the string, so send '1' for true and not the string 'true'''''' |
{| border="1" class="wikitable"å | {| border="1" class="wikitable"å | ||
|- | |- | ||
| Line 75: | Line 79: | ||
|- | |- | ||
! show_notes | ! show_notes | ||
| − | | | + | | 0 (false) |
| Displays job notes | | Displays job notes | ||
|- | |- | ||
! show_photos | ! show_photos | ||
| − | | | + | | 0 (false) |
| Displays job photos | | Displays job photos | ||
|- | |- | ||
! show_times | ! show_times | ||
| − | | | + | | 0 (false) |
| Display created at/updated at timestamps | | Display created at/updated at timestamps | ||
|- | |- | ||
! show_elements | ! show_elements | ||
| − | | | + | | 0 (false) |
| Display items / parts / assets | | Display items / parts / assets | ||
|- | |- | ||
! show_pre_checks | ! show_pre_checks | ||
| − | | | + | | 0 (false) |
| Displays pre job check results | | Displays pre job check results | ||
|- | |- | ||
! show_post_checks | ! show_post_checks | ||
| − | | | + | | 0 (false) |
| Displays post job check results | | Displays post job check results | ||
|- | |- | ||
! show_advanced | ! show_advanced | ||
| − | | | + | | 0 (false) |
| − | | | + | | Displays Repair information (Repair jobs only) |
|- | |- | ||
! show_activities | ! show_activities | ||
| − | | | + | | 0 (false) |
| Displays job activities | | Displays job activities | ||
|- | |- | ||
! show_vehicle_reg | ! show_vehicle_reg | ||
| − | | | + | | 0 (false) |
| Displays vehicle used (only if vehicles feature is installed) | | Displays vehicle used (only if vehicles feature is installed) | ||
|- | |- | ||
| + | ! show_failure_reason | ||
| + | | 0 (false) | ||
| + | | Displays Failure Type | ||
| + | |- | ||
| + | ! show_special_instructions | ||
| + | | 0 (false) | ||
| + | | Displays Special Instructions | ||
| + | |- | ||
| + | ! show_job_data | ||
| + | | 0 (false) | ||
| + | | Displays Job Data | ||
|} | |} | ||
Latest revision as of 15:54, 6 December 2016
Contents |
[edit] Get Job PDF
The MyMobileWorkers web portal provides a tool for exporting PDFs from the job data. In some integration cases it may be easier to pull the completed job down in PDF format than importing the data into your database. This call provides a way to remotely download the same PDFs the portal generates using your API key as authentication rather than having to log in via the web. Note however that options which may default to on on the portal likely default to off via the API.
The tool provided to do this is part of the web portal and not the api server, as such the URL is slightly different.
https://live.mymobileworkers.com/api/
The coding style is similar to the main API and returns the same set of error codes.
[edit] Summary
| Jobs | ||
|---|---|---|
| URL | https://:base_url/api/job_export?api_key=YOUR_KEY&job_number=JOB_NUMBER | |
| Type | GET | |
| Params: | api_key | required |
| job_number | required | |
| export_name | not required | |
| show_photos (etc, see below for full list) | not required | |
| Response | PDF / JSON (on error) | |
[edit] Responses
In the event of a successful export generation the tool will return a 200 response, and a PDF to download.
If an error occurs the tool will return either a 401 or 500 error code. The HTTP response code should be used to decide if the PDF was generated correctly. If a 401 or 500 response is returned the headers will be of type 'application/json' and the error code structure will match the rest of the API.
{"error_code":"JBE100","error_message":"Job cannot be found."}
[edit] Usage / Caching
Requesting PDFs via this tool can sometimes take an extended period to generate. It is suggested that any PDFs generated are not streamed directly to your end users but saved on your server for downloading.
[edit]
Custom headers and footers can be configured via the web portal. For more information please see here
KB article on custom headers/footers
Warning: If a header or footer is configured with either broken HTML or broken IMG tags then PDF will fail to generate
[edit] Available export templates
MyMobileWorkers has different types of exports for a job, these all use the same engine to generate the export but have different designs and options.
You can toggle which export you want to generate by setting the export_name flag. The default is "default_job" which is called the "Default job export" on the portal. Each export has its own set of optional flags you can pass as GET params to alter what is displayed on the report.
[edit] Default : export_name="default_job"
Below is a list of optional extra GET parameters which are related specifically to this export type
Use a value of 1 for true (show the item) or 0 for false (do not show the item)
Note: when sending get parameters use the boolean value not the string, so send '1' for true and not the string 'true'
| GET Param | Default value | Description |
|---|---|---|
| show_notes | 0 (false) | Displays job notes |
| show_photos | 0 (false) | Displays job photos |
| show_times | 0 (false) | Display created at/updated at timestamps |
| show_elements | 0 (false) | Display items / parts / assets |
| show_pre_checks | 0 (false) | Displays pre job check results |
| show_post_checks | 0 (false) | Displays post job check results |
| show_advanced | 0 (false) | Displays Repair information (Repair jobs only) |
| show_activities | 0 (false) | Displays job activities |
| show_vehicle_reg | 0 (false) | Displays vehicle used (only if vehicles feature is installed) |
| show_failure_reason | 0 (false) | Displays Failure Type |
| show_special_instructions | 0 (false) | Displays Special Instructions |
| show_job_data | 0 (false) | Displays Job Data |
[edit] Gas Safe : export_name = "default_gassafe"
| GET Param | Default value | Description |
|---|---|---|
| show_checklist | true | Displays second page checklist |