According to the APA Style website, "A digital object identifier (DOI) is a unique alphanumeric string assigned by a registration agency (the International DOI Foundation) to identify content and provide a persistent link to its location on the Internet. The publisher assigns a DOI when your article is published and made available electronically. All DOI numbers begin with a 10 and contain a prefix and a suffix separated by a slash. The prefix is a unique number of four or more digits assigned to organizations; the suffix is assigned by the publisher and was designed to be flexible with publisher identification standards."
Not all articles will have the DOI available. For articles without DOI, a shortened URL should be used. When the DOI is present, no need to list the URL. Purdue OWL specifies that whenever a DOI is available, it should be used over the URL, since they are more stable and long lasting than links.