Hi!
I'm fiddling with the API to try an make a small app, but I'm stuck very early on, as I don't see how I can fetch the campaign IDs for my campaigns, either through the API, or from the website.
I'm probably missing something very obvious there... any help is appreciated!
Thanks!
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Hi friend!
Does this page help at all with your questions? If not, I can send your question along to the devs :)
Hi @squirion27 - I realized I forgot to tag you. Just let us know if the above doesn't have what you need and we need to dig further into this!
Hello friend! I followed up with you via personal message; we hope we are able to answer your question. ☺ @squirion27
Obsidian Portal Support Druid | [email protected]
Hi @C4RBON and @vadercomplex !
Yes, I did peruse the API documentation. The issue is that all API calls seem to require the campaign_id as a call argument, and I cannot find a way to find the campaign_id for my campaigns (either from the website or the API).
If you could send the question to the devs, it would be very helpful, thanks!
Sending over to our Devs now! @squirion27
Obsidian Portal Support Druid | [email protected]
Thanks for your patience, my friend! @squirion27
Our Devs told us to provide you with this help document which should give you the information you're looking for:
https://db4sgowjqfwig.cloudfront.net/campaigns/282936/assets/1547325/op_api_test.rb?1769919909
Let us know if more help is needed ♥
Obsidian Portal Support Druid | [email protected]
Thanks @vadercomplex! I'll have a look as soon as I have the time to return to that project!
In regards to the campaign_id, here is what ChatGPT did to create code that I could pull the campaign_id:
We found the Obsidian Portal campaign ID through the authenticated API's
/v1/users/meendpoint, rather than trying to extract it from the campaign's website URL.The key distinction is that the campaign's human-readable URL slug and its internal API ID are different values.
Our approach was:
Authenticate to the Obsidian Portal API.
Request
GET /v1/users/me.Read the
campaignsarray in the response.Find the campaign whose
slugmatches the campaign you want.Use that entry's
idfield as thecampaign_idin subsequent API requests.For our campaign, the slug was
playgroundtheyawningportal.I verified this against the actual Python script in our GitHub repository. Here's a copy-ready answer for the community discussion:
I was able to retrieve my Obsidian Portal campaign ID using the authenticated API.
The trick was to call:
GET https://api.obsidianportal.com/v1/users/meThe JSON response includes a
campaignsarray. I found my campaign by matching itsslugagainst the slug in its website URL, then took theidfield from that campaign entry.For example, in Python:
That
idis what I used for subsequent requests, such as:GET /v1/campaigns/{campaign_id}/wikis.jsonI used OAuth 1.0a authentication with my consumer key, consumer secret, access token, and access token secret.
This worked for my campaign and allowed me to retrieve its wiki and character indexes. Hope it helps!
Thank you friend! Hope that works for you guys! And if there's any issue, you're welcomed to reach out. ☺ @squirion27
Obsidian Portal Support Druid | [email protected]