Using MDH Participants API Answered

Thejas Suvarna

I am trying to retrieve all participants within a segment using the API. The MDH platform indicates there are 63 active participants in the segment 01, but my API call to retrive all participants in segment 01 is only retrieving 20 participants.

How do I handle this issue?

0

Comments

1 comment

  • Comment author
    Thejas Suvarna
    • Official comment

    Hello,

    Here is the documentation for the Participant Query Request you will need to make to get all participants within a specific segment. In addition to the segmentID parameter that you will utilize to isolate which segment to retrieve participants from, you'll notice that there is also pageSize parameter as part of the request. The default for this parameter is actually 20 which explains why the participant list in the response only has 20 participants.

    There are two levers you can pull here:

    1. You can go ahead and increase this pageSize parameter to include more participants, however as the number of participants you are querying increases, this solution doesn't quite scale well with respect to performance.

    2. The initial response from the Query API includes a pageNumber. If you extract that value and add 1, you can access the next page of participants by utilizing the pageNumber parameter to the API request. You can continue to do this until you retrieve an empty list of participants from the API.

Please sign in to leave a comment.