---
title: Resource mapping
description: A synchronization mapping specifies a relationship between objects and their attributes in two data stores. The following example shows a typical attribute mapping, between objects in an external LDAP directory and an IDM managed user data store:
component: pingoneaic
page_id: pingoneaic:idm-synchronization:mappings
canonical_url: https://docs.pingidentity.com/pingoneaic/idm-synchronization/mappings.html
keywords: ["Synchronization", "Resource", "Mappings"]
section_ids:
  sync-mapping-paging: Paging synchronization mapping results
---

# Resource mapping

A synchronization mapping specifies a relationship between objects and their attributes in two data stores. The following example shows a typical attribute mapping, between objects in an external LDAP directory and an IDM managed user data store:

```
"source": "lastName",
"target": "sn"
```

In this case, the `lastName` source attribute is mapped to the `sn` (surname) attribute in the target LDAP directory.

The core synchronization configuration is defined in the mapping configuration *(tooltip: You can manage the mapping configuration over REST at the config/sync endpoint.)*.

For a list of *all* mappings, use the following request:

```
curl \
--header "Authorization: Bearer <access-token>" \
--header "Accept-API-Version: resource=1.0" \
--request GET \
"https://<tenant-env-fqdn>/openidm/sync/mappings?_queryFilter=true"
```

This call returns the mappings in the order in which they will be processed.

Mappings are always defined from a *source* resource to a *target* resource. To configure bidirectional synchronization, you must define two mappings. For example, to configure bidirectional synchronization between an LDAP server and an IDM repository, you would define the following two mappings:

* LDAP Server > IDM Repository

* IDM Repository > LDAP Server

Bidirectional mappings can include a `links` property that lets you reuse the links established between objects, for both mappings. For more information, see [Reuse Links Between Mappings](reusing-links.html).

You can update a mapping while the server is running. To avoid inconsistencies between data stores, do not update a mapping while a reconciliation is in progress *for that mapping*.

## Paging synchronization mapping results

With many synchronization mappings, use paging to retrieve the results in manageable chunks to avoid overwhelming the client. The `openidm/sync/mappings` endpoint supports paging with the `_pageSize` parameter and either cookies (`_pagedResultsCookie`) or offsets (`_pagedResultsOffset`).

Example: Cookie-based paging

In the following example, the source `source1` returns 3 results without a query filter (`mapping1`, `mapping4`, and `mapping7`).

1. To get the first page of results, with a page size of 2, send a request like this:

   ```
   curl \
   --header "Authorization: Bearer <access-token>" \
   --header "Accept-API-Version: resource=1.0" \
   --request GET \
   "http://<tenant-env-fqdn>/openidm/sync/mappings?_queryFilter=/source+eq+'source1'&_pageSize=2"
   ```

   The response includes a `pagedResultsCookie` containing the ID of the next available result (`mapping7`) that you can use to retrieve the next page:

   ```json
   {
     "result": [
       {
         "_id": "mapping1",
         "source": "source1",
         "target": "target1",
         "name": "mapping1",
         "sourceRouteReady": false,
         "targetRouteReady": false
       },
       {
         "_id": "mapping4",
         "source": "source1",
         "target": "target0",
         "name": "mapping4",
         "sourceRouteReady": false,
         "targetRouteReady": false
       }
     ],
     "resultCount": 2,
     "pagedResultsCookie": "mapping7",
     "totalPagedResultsPolicy": "EXACT",
     "totalPagedResults": 2,
     "remainingPagedResults": -1
   }
   ```

2. To get the next page of results, use the `_pagedResultsCookie` query parameter with the ID (`mapping7`) from the previous response:

   ```
   curl \
   --header "Authorization: Bearer <access-token>" \
   --header "Accept-API-Version: resource=1.0" \
   --request GET \
   "http://<tenant-env-fqdn>/openidm/sync/mappings?_queryFilter=/source+eq+'source1'&_pageSize=2&_pagedResultsCookie=mapping7"
   {
     "result": [
       {
         "_id": "mapping7",
         "source": "source1",
         "target": "target3",
         "name": "mapping7",
         "sourceRouteReady": false,
         "targetRouteReady": false
       }
     ],
     "resultCount": 1,
     "pagedResultsCookie": null,         (1)
     "totalPagedResultsPolicy": "EXACT",
     "totalPagedResults": 1,
     "remainingPagedResults": -1
   }
   ```

   |       |                                                                                           |
   | ----- | ----------------------------------------------------------------------------------------- |
   | **1** | The `pagedResultsCookie` has a `null` value, indicating no further results are available. |

Example: Offset-based paging

1. To get the first page of results, with a page size of 2 and an offset of 0:

   ```
   curl \
   --header "Authorization: Bearer <access-token>" \
   --header "Accept-API-Version: resource=1.0" \
   --request GET \
   "http://<tenant-env-fqdn>/openidm/sync/mappings?_queryFilter=/source+eq+'source1'&_pageSize=2&_pagedResultsOffset=0"
   {
     "result": [
       {
         "_id": "mapping1",
         "source": "source1",
         "target": "target1",
         "name": "mapping1",
         "sourceRouteReady": false,
         "targetRouteReady": false
       },
       {
         "_id": "mapping4",
         "source": "source1",
         "target": "target0",
         "name": "mapping4",
         "sourceRouteReady": false,
         "targetRouteReady": false
       }
     ],
     "resultCount": 2,
     "pagedResultsCookie": "mapping7",
     "totalPagedResultsPolicy": "EXACT",
     "totalPagedResults": 2,
     "remainingPagedResults": -1
   }
   ```

2. To get the second page of results, set the `_pagedResultsOffset` to the number of results already retrieved (in this case, 2):

   ```
   curl \
   --header "Authorization: Bearer <access-token>" \
   --header "Accept-API-Version: resource=1.0" \
   --request GET \
   "http://<tenant-env-fqdn>/openidm/sync/mappings?_queryFilter=/source+eq+'source1'&_pageSize=2&_pagedResultsOffset=2"
   {
     "result": [
       {
         "_id": "mapping7",
         "source": "source1",
         "target": "target3",
         "name": "mapping7",
         "sourceRouteReady": false,
         "targetRouteReady": false
       }
     ],
     "resultCount": 1,
     "pagedResultsCookie": null,
     "totalPagedResultsPolicy": "EXACT",
     "totalPagedResults": 1,
     "remainingPagedResults": -1
   }
   ```
