Apacta
API for a tool to craftsmen used to register working hours, material usage and quality assurance. # Endpoint The endpoint `https://app.apacta.com/api/v1` should be used to communicate with the API. API access is only allowed with SSL encrypted connection (https). # Authentication URL query authentication with an API key is used, so appending `?api_key={api_key}` to the URL where `{api_key}` is found within Apacta settings is used for authentication # Pagination If the endpoint returns a `pagination` object it means the endpoint supports pagination - currently it's only possible to change pages with `?page={page_number}` but implementing custom page sizes are on the road map. # Search/filter Is experimental but implemented in some cases - see the individual endpoints' docs for further explanation. # Ordering Is currently experimental, but on some endpoints it's implemented on URL querys so eg. to order Invoices by `invoice_number` appending `?sort=Invoices.invoice_number&direction=desc` would sort the list descending by the value of `invoice_number`. # Associations Is currently implemented on an experimental basis where you can append eg. `?include=Contacts,Projects` to the `/api/v1/invoices/` endpoint to embed `Contact` and `Project` objects directly. # Project Files Currently project files can be retrieved from two endpoints. `/projects/{project_id}/files` handles files uploaded from wall posts or forms. `/projects/{project_id}/project_files` allows uploading and showing files, not belonging to specific form or wall post. # Errors/Exceptions ## 422 (Validation) Write something about how the `errors` object contains keys with the properties that failes validation like: ``` { "success": false, "data": { "code": 422, "url": "/api/v1/contacts?api_key=5523be3b-30ef-425d-8203-04df7caaa93a", "message": "A validation error occurred", "errorCount": 1, "errors": { "contact_types": [ ## Property name that failed validation "Contacts must have at least one contact type" ## Message with further explanation ] } } } ``` ## Code examples Running examples of how to retrieve the 5 most recent forms registered and embed the details of the User that made the form, and eventual products contained in the form ### Swift ``` ``` ### Java #### OkHttp ``` OkHttpClient client = new OkHttpClient(); Request request = new Request.Builder() .url("https://app.apacta.com/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5") .get() .addHeader("x-auth-token", "{INSERT_YOUR_TOKEN}") .addHeader("accept", "application/json") .build(); Response response = client.newCall(request).execute(); ``` #### Unirest ``` HttpResponse<String> response = Unirest.get("https://app.apacta.com/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5") .header("x-auth-token", "{INSERT_YOUR_TOKEN}") .header("accept", "application/json") .asString(); ``` ### Javascript #### Native ``` var data = null; var xhr = new XMLHttpRequest(); xhr.addEventListener("readystatechange", function () { if (this.readyState === 4) { console.log(this.responseText); } }); xhr.open("GET", "https://app.apacta.com/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5"); xhr.setRequestHeader("x-auth-token", "{INSERT_YOUR_TOKEN}"); xhr.setRequestHeader("accept", "application/json"); xhr.send(data); ``` #### jQuery ``` var settings = { "async": true, "crossDomain": true, "url": "https://app.apacta.com/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5", "method": "GET", "headers": { "x-auth-token": "{INSERT_YOUR_TOKEN}", "accept": "application/json", } } $.ajax(settings).done(function (response) { console.log(response); }); ``` #### NodeJS (Request) ``` var request = require("request"); var options = { method: 'GET', url: 'https://app.apacta.com/api/v1/forms', qs: { extended: 'true', sort: 'Forms.created', direction: 'DESC', include: 'Products,CreatedBy', limit: '5' }, headers: { accept: 'application/json', 'x-auth-token': '{INSERT_YOUR_TOKEN}' } }; request(options, function (error, response, body) { if (error) throw new Error(error); console.log(body); }); ``` ### Python 3 ``` import http.client conn = http.client.HTTPSConnection("app.apacta.com") payload = "" headers = { 'x-auth-token': "{INSERT_YOUR_TOKEN}", 'accept': "application/json", } conn.request("GET", "/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5", payload, headers) res = conn.getresponse() data = res.read() print(data.decode("utf-8")) ``` ### C# #### RestSharp ``` var client = new RestClient("https://app.apacta.com/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5"); var request = new RestRequest(Method.GET); request.AddHeader("accept", "application/json"); request.AddHeader("x-auth-token", "{INSERT_YOUR_TOKEN}"); IRestResponse response = client.Execute(request); ``` ### Ruby ``` require 'uri' require 'net/http' url = URI("https://app.apacta.com/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new(url) request["x-auth-token"] = '{INSERT_YOUR_TOKEN}' request["accept"] = 'application/json' response = http.request(request) puts response.read_body ``` ### PHP (HttpRequest) ``` <?php $request = new HttpRequest(); $request->setUrl('https://app.apacta.com/api/v1/forms'); $request->setMethod(HTTP_METH_GET); $request->setQueryData(array( 'extended' => 'true', 'sort' => 'Forms.created', 'direction' => 'DESC', 'include' => 'Products,CreatedBy', 'limit' => '5' )); $request->setHeaders(array( 'accept' => 'application/json', 'x-auth-token' => '{INSERT_YOUR_TOKEN}' )); try { $response = $request->send(); echo $response->getBody(); } catch (HttpException $ex) { echo $ex; } ``` ### Shell (cURL) ``` $ curl --request GET --url 'https://app.apacta.com/api/v1/forms?extended=true&sort=Forms.created&direction=DESC&include=Products%2CCreatedBy&limit=5' --header 'accept: application/json' --header 'x-auth-token: {INSERT_YOUR_TOKEN}' ```
https://app.apacta.com/api/v1Auth: unknown
Endpoints: 136
Reachable: unknown
CORS: unknown
Endpoints
| Method | Path | Summary | Auth | Last Status | Latency |
|---|---|---|---|---|---|
GET |
/activities | Get a list of activities | — | — | — |
GET |
/cities | Get list of cities supported in Apacta | — | — | — |
GET |
/cities/{city_id} | Get details about one city | — | — | — |
GET |
/clocking_records | Get a list of clocking records | — | — | — |
GET |
/clocking_records/{clocking_record_id} | Details of 1 clocking_record | — | — | — |
GET |
/companies | Get a list of companies | — | — | — |
GET |
/companies/subscription_self_service | URL for subscription selfservice | — | — | — |
GET |
/companies/{company_id} | Details of 1 company | — | — | — |
GET |
/companies/{company_id}/companies_integration_feature_settings | List a company integration feature settings | — | — | — |
GET |
/companies/{company_id}/companies_integration_feature_settings/{c_integration_feature_setting_id} | View a company integration feature setting | — | — | — |
GET |
/companies/{company_id}/form_templates/ | Get a list of company form templates | — | — | — |
GET |
/companies/{company_id}/form_templates/{form_template_id} | Get a company form template | — | — | — |
GET |
/companies/{company_id}/integration_feature_settings | Get a list of integration feature settings | — | — | — |
GET |
/companies/{company_id}/integration_feature_settings/{integration_feature_setting_id} | Show details of 1 integration feature setting | — | — | — |
GET |
/companies/{company_id}/integration_settings | Get a list of company integration settings | — | — | — |
GET |
/companies/{company_id}/integration_settings/{companies_integration_setting_id} | Get a company integration setting | — | — | — |
GET |
/companies/{company_id}/price_margins/{price_margins_id} | Get a list of company price margins | — | — | — |
GET |
/companies_vendors | Get a list of companies vendors | — | — | — |
GET |
/companies_vendors/{companies_vendor_id} | Get a companies vendor | — | — | — |
GET |
/companies_vendors/{companies_vendor_id}/expense_statistics | Get companies vendor expense statistics | — | — | — |
GET |
/company_settings | Get a list of company settings | — | — | — |
GET |
/contact_custom_field_attributes | Get a list of contact custom field attributes | — | — | — |
GET |
/contact_custom_field_attributes/{contact_custom_field_attribute_id} | Details of 1 contact custom field attribute | — | — | — |
GET |
/contact_types | Get list of contact types supported in Apacta | — | — | — |
GET |
/contact_types/{contact_type_id} | Get details about one contact type | — | — | — |
GET |
/contacts | Get a list of contacts | — | — | — |
GET |
/contacts/{contact_id} | Details of 1 contact | — | — | — |
GET |
/contacts/{contact_id}/contact_custom_field_values | Get a list of contact custom field values | — | — | — |
GET |
/contacts/{contact_id}/contact_persons | Get a list of contact people | — | — | — |
GET |
/contacts/{contact_id}/contact_persons/{contact_person_id} | Get a contact person | — | — | — |
GET |
/countries | Get list of countries supported in Apacta | — | — | — |
GET |
/countries/{country_id} | Get details about one country | — | — | — |
GET |
/currencies | Get list of currencies supported in Apacta | — | — | — |
GET |
/currencies/{currency_id} | Get details about one currency | — | — | — |
GET |
/driving_types | List the driving types of the company | — | — | — |
GET |
/driving_types/{driving_type_id} | View driving type | — | — | — |
GET |
/employee_hours | Used to retrieve details about the logged in user's hours | — | — | — |
GET |
/events | Show list of events | — | — | — |
GET |
/events/is_user_free | Check if user is available at given datetime range | — | — | — |
GET |
/events/{event_id} | Show event | — | — | — |
GET |
/expense_files | Show list of expense files | — | — | — |
GET |
/expense_files/{expense_file_id} | Show file | — | — | — |
GET |
/expense_lines | Show list of expense lines | — | — | — |
GET |
/expense_lines/{expense_line_id} | Show expense line | — | — | — |
GET |
/expenses | Show list of expenses | — | — | — |
GET |
/expenses/highest_amount | Show highest Expense amount(`total_selling_price`) | — | — | — |
GET |
/expenses/{expense_id} | Show expense | — | — | — |
GET |
/expenses/{expense_id}/original_files | Show list of all OIOUBL files for the expense | — | — | — |
GET |
/expenses/{expense_id}/original_files/{file_id} | Show OIOUBL file | — | — | — |
GET |
/financial_statistics | Get general statistics | — | — | — |
GET |
/financial_statistics/expensesSalesPrice | Get expenses sales price | — | — | — |
GET |
/financial_statistics/invoicedAmount | Get invoiced amount | — | — | — |
GET |
/financial_statistics/margin | Get margin | — | — | — |
GET |
/financial_statistics/materialRentalsCostPrice | Get products material rentals cost price | — | — | — |
GET |
/financial_statistics/overview | Get statistics overview | — | — | — |
GET |
/financial_statistics/productsCostPrice | Get products cost price | — | — | — |
GET |
/financial_statistics/workingHours | Get Total working hours grouped by time entry type | — | — | — |
GET |
/form_field_types | Get list of form field types | — | — | — |
GET |
/form_field_types/{form_field_type_id} | Get details about single `FormField` | — | — | — |
GET |
/form_fields/{form_field_id} | Get details about single `FormField` | — | — | — |
GET |
/form_templates | Get array of form_templates for your company | — | — | — |
GET |
/form_templates/{form_template_id} | View one form template | — | — | — |
GET |
/forms | Retrieve array of forms | — | — | — |
GET |
/forms/undelete/{form_id} | Undelete form and related entities to it | — | — | — |
GET |
/forms/view_time_form_pdf/{form_id} | Generate time form pdf | — | — | — |
GET |
/forms/{form_id} | View form | — | — | — |
GET |
/integrations | Get integrations list | — | — | — |
GET |
/integrations/contactsSync | Force Synchronization with ERP systems | — | — | — |
GET |
/integrations/productsSync | Sync products from erp integration | — | — | — |
GET |
/integrations/{integration_id} | View integration details | — | — | — |
GET |
/invoice_line_text_template | Get a list of invoice line text templates | — | — | — |
GET |
/invoice_line_text_template/{invoice_line_text_template_id} | Get a single invoice line text template | — | — | — |
GET |
/invoice_lines | View list of invoice lines | — | — | — |
GET |
/invoice_lines/{invoice_line_id} | View invoice line | — | — | — |
GET |
/mass_messages_users | View list of mass messages for specific user | — | — | — |
GET |
/mass_messages_users/{mass_messages_user_id} | View mass message | — | — | — |
GET |
/materials | View list of all materials | — | — | — |
GET |
/materials/{material_id} | View material | — | — | — |
GET |
/materials/{material_id}/rentals/ | Show list of rentals for specific material | — | — | — |
GET |
/materials/{material_id}/rentals/{material_rental_id}/ | Show rental foor materi | — | — | — |
GET |
/offer_statuses | Get list of offer statuses | — | — | — |
GET |
/offer_statuses/{offer_status_id} | Get a single offer status | — | — | — |
GET |
/offers | View list of offers | — | — | — |
GET |
/offers/{offer_id} | View offer | — | — | — |
GET |
/offers/{offer_id}/changelog | Get list of changelog history for the offer. Returns offer object with contact and user objects if they are provided | — | — | — |
GET |
/overview/rejection_reasons | Get a statistics data for rejection reasons | — | — | — |
GET |
/payment_term_types | Get a list of payment term types | — | — | — |
GET |
/payment_term_types/{payment_term_type_id} | Details of 1 payment term type | — | — | — |
GET |
/payment_terms | Get a list of payment terms | — | — | — |
GET |
/payment_terms/erp | Get integration payment terms list | — | — | — |
GET |
/payment_terms/{payment_term_id} | Details of 1 payment term | — | — | — |
GET |
/ping | Check if API is up and API key works | — | — | — |
GET |
/products | List products | — | — | — |
GET |
/products/{product_id} | View single product | — | — | — |
GET |
/products/{product_id}/variants | Get a product's variants | — | — | — |
GET |
/project_custom_field_attributes | Get a list of project custom field attributes | — | — | — |
GET |
/project_custom_field_attributes/{project_custom_field_attribute_id} | Details of 1 project custom field attribute | — | — | — |
GET |
/project_status_types | Get a list of project status types | — | — | — |
GET |
/project_statuses | Get list of project statuses | — | — | — |
GET |
/project_statuses/{project_status_id} | Get a single project status | — | — | — |
GET |
/projects | View list of projects | — | — | — |
GET |
/projects/has_projects_with_custom_statuses | Check if the company has projects with custom statuses | — | — | — |
GET |
/projects/{project_id} | View specific project | — | — | — |
GET |
/projects/{project_id}/all_files | Show list of all files uploaded to project | — | — | — |
GET |
/projects/{project_id}/files | Show list of files uploaded to project | — | — | — |
GET |
/projects/{project_id}/files/{file_id}/ | Show file | — | — | — |
GET |
/projects/{project_id}/project_files | Show list of project files uploaded to project | — | — | — |
GET |
/projects/{project_id}/project_files/{project_file_id}/ | Show project file | — | — | — |
GET |
/reports | — | — | — | — |
GET |
/stock_locations | List stock_locations | — | — | — |
GET |
/stock_locations/{location_id} | View single location | — | — | — |
GET |
/time_entries | List time entries | — | — | — |
GET |
/time_entries/{time_entry_id} | View time entry | — | — | — |
GET |
/time_entry_intervals | List possible time entry intervals | — | — | — |
GET |
/time_entry_intervals/{time_entry_interval_id} | View time entry interval | — | — | — |
GET |
/time_entry_rates | List time entry rates | — | — | — |
GET |
/time_entry_rates/{time_entry_rate_id} | View time entry rate | — | — | — |
GET |
/time_entry_rule_groups | List time entry rule groups | — | — | — |
GET |
/time_entry_types | List time entries types | — | — | — |
GET |
/time_entry_types/{time_entry_type_id} | View time entry type | — | — | — |
GET |
/time_entry_unit_types | List possible time entry unit types | — | — | — |
GET |
/time_entry_unit_types/{time_entry_unit_type_id} | View time entry unit type | — | — | — |
GET |
/time_entry_value_types | List possible time entry value types | — | — | — |
GET |
/time_entry_value_types/{time_entry_value_type_id} | View time entry value type | — | — | — |
GET |
/user_custom_field_attributes | Get a list of user custom field attributes | — | — | — |
GET |
/user_custom_field_attributes/{user_custom_field_attribute_id} | Details of 1 user custom field attribute | — | — | — |
GET |
/vendor_product_price_files | Get a list of price files | — | — | — |
GET |
/vendor_product_price_files/{vendor_product_price_file_id} | Get a single price file | — | — | — |
GET |
/vendor_products | List vendor products | — | — | — |
GET |
/vendor_products/{vendor_product_id} | View single vendor product | — | — | — |
GET |
/vendors | Get a list of vendors | — | — | — |
GET |
/vendors/{vendor_id} | Get a vendor | — | — | — |
GET |
/wages/downloadSalaryFile | Download salary file | — | — | — |
GET |
/wall_comments/{wall_comment_id} | View wall comment | — | — | — |
GET |
/wall_posts | View list of wall posts | — | — | — |
GET |
/wall_posts/{wall_post_id} | View wall post | — | — | — |
GET |
/wall_posts/{wall_post_id}/wall_comments | See wall comments to a wall post | — | — | — |