GuideIntegration appsAPIPOST /api/v1/synchronizer/data

Data endpoint performs actual data retrieving for the specified integration settings. Data retrieving is run by each type independently.

Data synchronization supports:

  • pagination
  • delta synchronization

Request

Inbound payload includes following information:

  • types - array of selected type ids
  • requestedType - currently fetching type
  • account - account on behalf of data should be fetched
  • filter - currently configured filters
  • lastSynchronizedAt - OPTIONAL field that indicated when last successful synchronization was run
  • pagination - OPTIONAL field includes pagination settings that was returned from previous data request

Request example:

{
    "requestedType": "pullrequest",
    "types": ["repository", "pullrequest"],
    "filter": {
        "owner": "fibery",
        "repositories": ["fibery/core", "fibery/ui", "fibery/apps-gallery"]
    },
    "account": {
        "token": "token"
    },
    "pagination": {
        "repositories": ["fibery/ui", "fibery/apps-gallery"]
    },
    "lastSynchronizedAt": "2020-09-30T09:08:47.074Z"
}

Response

Outboud payload includes:

  • items - REQUIRED array of fetched data rows
  • pagination - OPTIONAL parameter that includes information about pagination

    • hasNext - boolean attribute that indicates that there are more pages available
    • nextPageConfig - object that will be passed in pagination request body parameter with next page request
  • synchronizationType - OPTIONAL parameter with possible values delta or full. It indicates how data will be handled on Fibery side. If delta is set then only provided changes will be applied. Fibery will be looking for __syncAction field to identify whether row should be set or removed. If __syncAction equal REMOVE then corresponding entity will be removed. If full is set then unsynced data will be removed (if keep unsynced is unchecked).

Response example:

{
    "items": [
        {
            "id": "PR_1231",
            "name": "Improve performance"
        },
        {
            "id": "PR_1232",
            "name": "Fix bugs"
        }
    ],
    "pagination": {
        "hasNext": true,
        "nextPageConfig": {
            "repositories": ["fibery/apps-gallery"]
        }
    },
    "synchronizationType": "full"
}

Errors

If something goes wrong then integration app should respond with corresponding error HTTP status code and error message.

{
    "message": "Unable to fetch data."
}

But some errors can be fixed if try to fetch data later. In this case error body should include tryLater flag with value true. Fibery will retry this particular page later on.

{
    "message": "Rate limits reached",
    "tryLater": true
}