% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/pmFetchById.R
\name{pmFetchById}
\alias{pmFetchById}
\title{Fetch PubMed records by PMID}
\usage{
pmFetchById(pmids, api_key = NULL, batch_size = 200)
}
\arguments{
\item{pmids}{is a character or numeric vector. A vector of PubMed identifiers (PMIDs).}

\item{api_key}{is a character. It contains a valid API key for the NCBI E-utilities.
Default is \code{api_key=NULL}. The API key can also be set via the environment variable
\code{PUBMED_API_KEY} or \code{ENTREZ_KEY}.}

\item{batch_size}{is numeric. The number of records to download per API request. Default is 200.}
}
\value{
a list following the same structure as \code{\link{pmApiRequest}} output, containing:
\tabular{lll}{
data \tab \tab The xml-structured list containing the bibliographic metadata.\cr
query \tab \tab A character string describing the PMID-based query.\cr
query_translation \tab \tab Same as query for PMID-based searches.\cr
records_downloaded \tab \tab The total number of records downloaded.\cr
total_count \tab \tab The total number of PMIDs requested.}
}
\description{
It downloads metadata for a set of PubMed articles identified by their PMID (PubMed Identifier).
This is useful for retrieving specific known articles, updating existing datasets,
or downloading records identified through other sources.
}
\details{
The function uses the NCBI E-utilities \code{efetch} endpoint to retrieve records directly
by their PMIDs, without requiring a search query. Records are downloaded in batches
to respect API rate limits.

The output is compatible with \code{\link{pmApi2df}} for conversion to a dataframe.
}
\examples{

\donttest{
# Download specific articles by PMID
pmids <- c("34813985", "34813456", "34812345")
D <- pmFetchById(pmids = pmids)
M <- pmApi2df(D)
}

}
\seealso{
\code{\link{pmApiRequest}}

\code{\link{pmApi2df}}
}
