Introducing: a client for the PubPub API #2576
tefkah
started this conversation in
Show and tell
Replies: 2 comments 2 replies
-
Hey Thomas! Just wanted to say we saw this over the weekend and love that you built it. We can't immediately support or recommend it right at this moment, but we are going to reach out for a chat about how we might be able to. Talk soon! |
Beta Was this translation helpful? Give feedback.
1 reply
-
Thanks. I'm hoping we can get this working for the Unjournal. Atm it's taking us about 3-4 hours to process the many parts of an evaluation of a paper; hoping to automate as as much as possible with the API. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi all! I was slightly hesitant to share this, because I wasn't sure how happy PubPub would be with it and whether they might try to limit access, but I thought it'd be better to be cooperative than sneaky, so presenting: a client for interacting with the PubPub API!
After this discussion (#1742) I looked through a lot of the PubPub source code to try and (reverse-)engineer a way to do the same things with PubPub through code as you would in the app, and I'm happy to say I mildly succeeded!
With the current client, you can
You just need an admin PubPub account (no support for more granular permissions yet) and your community URL and ID. You can find your community's ID, as well as the IDs for public Pubs and collections at this website I made (https://pubpub.tefkah.com).
What's not possible yet
PubPub.logout
though, I would like to implement some kind of error catching thingy that auto-logs out if something goes wrong.What's intentionally not possible
Some of these things (like getting Collections and importing documents) are achieved through quite hacky means (just fetching the relevant page and parsing the data that is passed there) as I could not find any other means of doing so (there is no "get collections" endpoint for instance).
Also, AFAIK there are no very concrete typings or definitions for the endpoints, so most of the input/output types are guesswork on my end and can probably break!
It is quite unstable as I haven't thoroughly tested every method yet, but I can confirm it works though! I was able to import 30 word docs in very little time using it :)
Hope you find it useful, I hope this can lead to more cool integrations with PubPub!
And to @gabestein, if this poses any problem to you please let me know and I will either modify it or take it down!
All the best,
Thomas
Beta Was this translation helpful? Give feedback.
All reactions