How to get all post of custom post type by rest api?

The REST API supports grabbing a maximum of 100 posts at a time, so you’ll have to make an additional call for every 100.

Start with wp_remote_get() for 100 posts. While you’re at it, go ahead and retrieve the body of this page and decode it:

$transcripts = wp_remote_get('http://example.com/wp-json/wp/v2/transcript/?per_page=100');
$transcriptsBody = wp_remote_retrieve_body($transcripts);
$transcriptsDecoded = json_decode($transcriptsBody, true);

Next, identify how many pages of 100 currently exist:

$numPages = wp_remote_retrieve_header($transcripts, 'x-wp-totalpages');

Then, if there’s more than 1 page, grab each additional page. Start at page 2, since you’ve already grabbed page 1.

if($numPages > 1) {
    for($i=2; $i<($numPages+1); $i++) {
        // Identify the next endpoint to call
        $nextUrl="http://example.com/wp-json/wp/v2/transcript/?per_page=100&page=" . $i;
    }
    // Remote_get that endpoint
    $nextPage = wp_remote_get("$nextUrl");
    // Set a variable variable name for the next page
    $bodyVar="transcripts" . $i;
    // Get the body of the current page
    $$bodyVar = wp_remote_retrieve_body($nextPage);
    // Set a variable variable name for the decoded body
    $decodeVar="transcriptsDecoded" . $i;
    // Decode the JSON
    $$decodeVar = json_decode(${$bodyVar}, true);
    // Finally, merge the posts into the existing decoded array
    $transcriptsDecoded = array_merge($transcriptsDecoded, $$decodeVar);
}

You’ll now have a PHP array of all of the posts, no matter how few or many posts there are.

Note that if you pull using the REST API and save the posts to a different database, you’ll have a static copy. If anyone updates, deletes, or adds to the original site, your copy won’t be in sync. So, it’s more common to build the REST API calls into the code of the other site where you want to display the content, so that it reaches out and grabs the specific content you want to display right then and there. (And ideally, caches that for at least a few hours or days, so you’re not constantly waiting on data to reload.)