Say I have a physical system that gives me directly a set of equations in terms of the generalised coordinates ($q_{i}$) and generalised momenta ($p_{i}$) as
$$\frac{dq_{i}}{dt}=\dot{q_{i}}=f_{1}(\vec{q},\vec{p},t),$$ $$\frac{dp_{i}}{dt}=\dot{p_{i}}=f_{2}(\vec{q},\vec{p},t),$$
with index $i=1, \cdots, n$, where $\vec{q}=(q_{1}, \cdots, q_{n})$, $\vec{p}=(p_{1}, \cdots, p_{n})$ and $n$ is the degrees of freedom (number of independent variables). The functions $f_{1}$ and $f_{2}$ are known.
I would like to use these as my canonical equations to extract a Hamiltonian $H=H(\vec{q},\vec{p},t)$ that would satisfy them.
Classically we are given $H$ first and then we take the partial derivates in $p$ and $q$ to get these canonical equations; namely
$$\dot{q_{i}}=\frac{\partial H}{\partial p_{i}}$$ $$\dot{p_{i}}=-\frac{\partial H}{\partial q_{i}}$$
Now I am concerned with the opposite direction.
I suspect the answer will not be unique. Nevertheless, the fact that $\partial H/\partial t=d H/dt$ makes attempts to integrate rather futile. Any suggestions would be appreciated.
Since you know the vector $(\partial H/\partial q_1,\dots,\partial H/\partial q_n,\partial H/\partial p_1,\dots,\partial H/\partial p_n)$, you can follow the usual step-by-step procedure for finding a potential for a vector field (or showing that there is none), which is illustrated for example in this answer in a case with three variables.