Bu yazı ile nasıl otorizasyon sağlayabileceğinizi ve liste meta-data'sına nasıl ulaşabileceğiniz öğreneceksiniz. Bu yazı sınırlı bir kapsam ile zamanla geliştirilecek bir döküman olarak oluşturuldu. Daha kapsamlı ve formal bilgilendirme için:
Kaynaklar:
Swagger spec : https://api.workiom.com/swagger/.
API endpoint : https://api.workiom.com.

**Otorizasyon**

Workiom'daki tüm API'lar header kısmına eklenmesi için bir API Key gerektirmektedir. Hesabınıza ait API Key profil ayarlarınızda bulunabilir.



"**X-Api-Key**" ismini kullanarak header'a ekleyiniz.

Örnek

curl -X GET "https://api.workiom.com/api/services/app/Apps/GetAll" -H "accept: text/plain" -H "X-Api-Key: {Your API Key}"

**Get List Meta Data**
Listeler üzerinde yapmak isteyeceğiniz çoğu değişiklik öncelikle liste meta-data'sına erişmenizi gerektirecektir. Bu erişim listedeki alanlar, görünümler ve bunların ID'leri gibi kullanışlı bilgiler sağlayacaktır.

GET `/api/services/app/Lists/Get`
Content-Type "application/json"
Headers`Authorization` Bearer \*your-access-token\*
Parameters
id: string
expand: array[string] (any combination of: “Fields”, “Views”, “Filters”)

Response

{ "appId": "string", "fields": [ { "name": "string", "description": "string", "dataType": 0, "summaryType": 0, "listId": "string", "staticListValues": [ { "id": "string", "label": "string", "order": 0 } ], "isPrimary": true, "isRequired": true, "isVisible": true, "isMainPicture": true, "format": "string", "order": 0, "allowMultiple": true, "linkedAppId": "string", "linkedListId": "string", "linkedFieldId": 0, "dateType": 0, "rollupFieldId": 0, "rollupSummaryType": 0, "isComputed": true, "expression": "string", "isDeleted": true, "deleterUserId": 0, "deletionTime": "2018-12-04T17:29:08.144Z", "lastModificationTime": "2018-12-04T17:29:08.144Z", "lastModifierUserId": 0, "creationTime": "2018-12-04T17:29:08.144Z", "creatorUserId": 0, "id": 0 } ], "name": "string", "description": "string", "defaultView": { "name": "string", "description": "string", "viewType": 0, "fieldId": 0, "isDefault": true, "listId": "string", "filters": [ { "fieldId": 0, "operator": 1, "value": {}, "viewId": 0, "id": 0 } ], "state": "string", "lastModificationTime": "2018-12-04T17:29:08.144Z", "lastModifierUserId": 0, "creationTime": "2018-12-04T17:29:08.144Z", "creatorUserId": 0, "id": 0 }, "icon": "string", "order": 0, "isVisible": true, "views": [ { "name": "string", "description": "string", "viewType": 0, "fieldId": 0, "isDefault": true, "listId": "string", "filters": [ { "fieldId": 0, "operator": 1, "value": {}, "viewId": 0, "id": 0 } ], "state": "string", "lastModificationTime": "2018-12-04T17:29:08.145Z", "lastModifierUserId": 0, "creationTime": "2018-12-04T17:29:08.145Z", "creatorUserId": 0, "id": 0 } ], "lastModificationTime": "2018-12-04T17:29:08.145Z", "lastModifierUserId": 0, "creationTime": "2018-12-04T17:29:08.145Z", "creatorUserId": 0, "id": "string"}

**Get List Records**
Listedeki kayıtlara erişmek sade ve esnek bir şekilde sağlanabilir. Bir 'listId' belirterek listedeki kayıtlara erişebilirsiniz, ayrıca sıralama ('sorting') seçimi de belirtebilirsiniz, 'maxResultCount' ve 'skipCount' kullanabilirsiniz, veya çeşitli filtreler ekleyerek elde edeceğiniz kayıtların kapsamını değiştirebilirsiniz.

POST `/api/services/app/Data/All`
Content-Type "application/json"
Headers`Authorization` Bearer \*your-access-token\*
Body

{ "listId": "string", "filter": [ { "fieldId": 0, "operator": 1, "value": 0 } ], "linkedItemsLimit": 0, "projectedFields": [ 0 ], "sorting": "string", "maxResultCount": 0, "skipCount": 0}

Response

{ "summary": { "additionalProp1": 0, "additionalProp2": 0, "additionalProp3": 0 }, "totalCount": 0, "items": [ {} ]}

**Creating Records**

Records are simple JSON objects in which each key is a fieldId and each value is that record’s value for the field. Different fields might have different data-types, you can find a field’s id and dataType from the list’s meta-data response.

POST `/api/services/app/Data/Create`
Content-Type "application/json"
Headers`Authorization` Bearer \*your-access-token\*
Parameters`listId: string`
Body

{ // This is an example of a record /* fieldId: value */ "1186": "2018-11-13T00:00:00.000+00:00", "1251": "[email protected]", "1421": [ { "_id": "r29jrg8hgg48g33nig", "label": "linked record" }, { "_id": "1354535tregrfrwni2", "label": "another linked record" } ], "1425": "Ahmad Lam", "1532": 132, "1563": { "id": "14372839", "label": "static list item" }, "1591": { "id": "28349232", "label": "Khaled Sameeh" }}

**Filters**

Filters can be used when requesting data. Usually an array of filter objects containing the fieldId to filter on, the filter operator and a filter value. For example, a filter property in a Data/All request might be:

{ "filters": [ { "fieldId": 1425, "operator": 1, "value": "Ahmad Masa" } ]}

The filter operators are:

Contains = 1,
DoesNotContain = 2,
Is = 3,
IsNot = 4,
Greater = 5,
GreaterOrEqual = 9,
Less = 6,
LessOrEqual = 10,
Between = 11,
IsEmpty = 7,
IsNotEmpty = 8,
In = 12,
NotIn = 13

**Sorting**

Sorting can be done using a sort string containing the fieldId to sort on and a sorting direction. For example, ascending sort on field 11284 is:

sorting: "11284 ASC"

For descending sort on the same field:

sorting: "11284 DESC"

**Data Types**

Workiom supports many field data-types, fields with different data-types accept values of different types. A Date field would only accept dates, while a LinkedList field would only accepts an array of objects containing the linked record IDs. Data-types are represented by the following numbers:

Text = 0,
Number = 1,
DateTime = 2,
Boolean = 3,
StaticSelect = 4,
LinkList = 5,
User = 6,
Website = 7,
Email = 8,
File = 9,
Rollup = 10,
PhoneNumber = 11,
Count = 12,
Currency = 13,
AutoNumber = 14,
CheckList = 15

Updating Records

Record updates are almost as simple as record creation. You just have to do

a PUT call instead of POST, and you must provide the record ID in

addition to the list ID. This is a standard PUT request, so the request

body is the whole record, with the changed fields modified.

PUT /api/services/app/Data/Update
Content-Type: "application/json"
Headers: `Authorization Bearer [your-access-token`]
Parameters: listId: string, id: string
Body

{

"1186": "2019-11-13T00:00:00.000+00:00",

"1251": "[[email protected]](/cdn-cgi/l/email-protection)",

"1421": [

{

"_id": "r29jrg8hgg48g33nig",

"label": "linked record"

},

{

"_id": "1354535tregrfrwni2",

"label": "another linked record"

}

],

"1425": "Ahmad Lam",

"1532": 132,

"1563": {

"id": "14372839",

"label": "static list item"

},

"1591": {

"id": "28349232",

"label": "Khaled Sameeh"

}

}

Partially Updating Records

If you do not wish to send the whole record with every update, you can use

the /UpdatePartial end point, which allows you to send only the changed

fields, unlike the standard PUT endpoint at /Update.

PUT `/api/services/app/Data/UpdatePartial`
Content-Type: "application/json"
Headers: `Authorization Bearer [your-access-token`]
Parameters: listId: string, id: string
Body

{

"1186": "2019-11-13T00:00:00.000+00:00",

"1251": "[[email protected]](/cdn-cgi/l/email-protection)",

}

For any question, please reach us on [[email protected]](/cdn-cgi/l/email-protection#f2818782829d8086b2859d80999b9d9fdc919d9f).
Bu yazı size yardımcı oldu mu?
İptal etmek
Teşekkürler!