ApactaAPI 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 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, r…
번역은 이해를 돕기 위한 미검수 초벌 또는 구조화 안내입니다. 계약·의료·법률 판단에는 원문을 확인하세요.