INSPIRE Creating a publication list

Q: Is there a way to generate a list of all my publications that I could add to my CV or personal website?

A: Yes, you can use an API (Application Programming Interface) to query Inspire outside your web browser. More in depth information on using the Inspire API can be found here.

One method of initiating an API query from your command line interface of choice (such as PuTTY) is by using curl, a command line tool for transferring data with URL syntax. Simply open the console and type curl 'https://inspirehep.net/.....' with the rest of your search after the last slash. Then hit enter/return to retrieve the results.

Inspire API query format

The API requests have the following general form:

/search?p=...&of=...&rg=...&jrec=...

p = pattern (query)

This is the query in the Inspire search syntax. All search features and operators used in the Inspire web interface and documented in the online help are supported, and complex queries are possible.

of = output format

The format of the response sent back to the client.

of=tlcv - CV format (LaTeX)
of=hcv - CV format (html)
of=htcv - CV format (text)
of=hx - BibTeX
of=hlxe - LaTeX (EU)
of=hlxu - LaTeX (US)

In the examples below we'll use of=hx.

rg = records in groups of (25)

This parameter specifies the number of records per chunk for long responses. Note that the default setting is 25 records per chunk. The maximum number is 250.

jrec = jump to record (123)

Long responses are split into several chunks. To access subsequent chunks specify the record offset with this parameter. For example, if you have more than 250 publications, rg=250 will allow you to view the first 250, and rg=250&jrec=251 will allow you to view the next 250. Substitute the numbers to suit your needs.

sf = sort by

Adding &sf=year to your query allows you to sort the results by year.

so sort order

Combine sf=year with so=d to sort the results by descending chronological order.

Query Example

Let's generate a list of Edward Witten's publications:

curl 'https://inspirehep.net/search?p=f+a+ed+witten&of=hx&em=B&sf=year&so=d&rg=250' | more

returns

<div class="pagebody"><div class="pagebodystripemiddle">
<pre>
@article{WITTEN:2014wma,
     author = "Witten, Edward",
     title = "{Reflections on LHC Physics}",
     journal = "PoS",
     volume = "2008LHC",
     pages = "098",
     year = "2008",
     SLACcitation = "%%CITATION = POSCI,2008LHC,098;%%",
}
</pre>

<pre>
@article{Donagi:2014hza,
     author = "Donagi, Ron and Witten, Edward",
     title = "{Super Atiyah classes and obstructions to splitting of supermoduli space}",
     year = "2014",
     eprint = "1404.6257",
     archivePrefix = "arXiv",
     primaryClass = "hep-th",
     SLACcitation = "%%CITATION = ARXIV:1404.6257;%%",
}
</pre>

...

</div></div>

The | more at the end of the line lets you view the results in chunks that fit your window. To view the next "page", hit the spacebar.

In order to view the rest of Witten's publications beyond the first 250, our next query would be:

curl 'https://inspirehep.net/search?p=f+a+ed+witten&of=hx&em=B&sf=year&so=d&rg=250&jrec=251' | more

Saving a publication list:

Adding >filename.txt to the end of your query will save the results in a .txt file. You'll have to save each &rg= chunk separately and then combine them when you are finished.

curl 'https://inspirehep.net/search?p=f+a+ed+witten&of=hx&em=B&sf=year&so=d&rg=250' > witten.tex

curl 'https://inspirehep.net/search?p=f+a+ed+witten&of=hx&em=B&sf=year&so=d&rg=250&jrec=251' >> witten.tex

To remove the html <pre> and <div> statements from "witten.tex", a one-line perl command can be run, such as

perl -i -pe 's/<\/?\w+>//g;s/<[^<]+pagebody[^>]+>//g' witten.tex

If you have questions, please send them to feedback@inspirehep.net

Last modified: 2014-10-31