Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to push created or updated Journal Entry Pages back to World Anvil to create or update Articles. #6

Open
aaclayton opened this issue Jun 13, 2020 · 5 comments
Labels
feature-request Feature requests wa-api Issues which need additional features from the World Anvil API in order to become possible.

Comments

@aaclayton
Copy link
Contributor

Example use cases

  1. session notes. During a game session players can use the in-game Foundry journal to take notes, but at the end of the session they could use a button to create a new World Anvil article.

  2. Actors. During a game session, you might create some NPCs on the fly as the heroes encounter characters you had not yet planned. It would be great to be able to, after the session, push those new characters to World Anvil so they become part of your world lore and you can remember them later.

@aaclayton
Copy link
Contributor Author

In GitLab by @admiralnlson on Nov 22, 2020, 04:13

On point 2), as far as I can see, so far,

  • WA world 'Person' articles are imported as Journal items, not as Actors,
  • and WA campaign NPCs (which point to 'Person' articles) are not imported at all.

So it would seem to me the WA->Foundry sync (GET) may have to be adapted (and decisions on how to map the respective data models of WA and Foundry made) before a POST for Actors can be considered.

@aaclayton
Copy link
Contributor Author

Makes sense, I agree this is not a high priority enhancement - it's just a placeholder to track a future feature possibility. I think ensuring that all the WA -> FVTT data flows work properly first is certainly more important than implementing FVTT -> WA flows.

@aaclayton aaclayton changed the title Add a POST endpoint to create a World Anvil article from within a remote application like Foundry. Add a POST endpoint to create or update articles in World Anvil article from within a remote application like Foundry VTT. Dec 22, 2022
@DawidIzydor
Copy link

From the WorldAnvil documentation there are both POST and PATCH endpoints for articles

https://www.worldanvil.com/api/aragorn/documentation

POST is for creating new articles, PATCH for updating existing ones

The biggest issue IMO for updating articles would be resolving conflicts in case the same article was modified both on WA and in Foundry

@DawidIzydor
Copy link

To not to have to deal with conflicts ATM I suggest

  1. Storing last update time of each imported article, using "update_date"->"date" field
  2. If the update time wasn't changed since the last sync check if the content was modified
  3. If update time wasn't changed but the content was modified it means the user has changed content locally: push local changes to WA
  4. If the update time was changed move local content to a "Last local version" page and update the local article with version from WA, also notify the user about this and make them resolve any conflicts manutally

This can be further improved by also having last sync content stored invisibly to the user and check if the current content is different than the last sync content - if it's the same then the user didn't make any changes locally to the article

Also this functionality should be disabled by default as it can potentially lead to issues. This includes but it's not limited to 1. Not being able to differentiate between changes made by GM and by Players if they have edit access to an article, 2. Irreversibly deleting part of content from WA by making mistake change on Foundry, 3. Potentially exploit the WA EULA - players being able to modify the articles means the user is de facto increasing the number of article authors - but everything will be published under one, GM, name

Another take is to have a little bit less automation, and add a new button to push changes from local to WA. This could first fetch the current article and check the update date and if the update date was modifies since the last sync - prompt the user that they might override some changes from the WA and if they're sure they want do it

Also worth noting is that this shouldn't be a very common issue, especially if we tell the GMs to automatically sync changes from WA when they start a world (or even add a feature to do it upon world startup), to minimize the chances of someone editing the same entry both in WA and Foundry at the same time

@aaclayton
Copy link
Contributor Author

Hi @DawidIzydor thanks for pointing that out - these endpoints must have been added within the last year. I'll update the title of the issue to reflect the next steps being to make use of them. I probably won't have time to work on this in the near future, but I'm open to receiving contributions from capable community devs who would like to see this support added.

@aaclayton aaclayton changed the title Add a POST endpoint to create or update articles in World Anvil article from within a remote application like Foundry VTT. Add support to push created or updated Journal Entry Pages back to World Anvil to create or update Articles. Dec 30, 2022
@aaclayton aaclayton added the feature-request Feature requests label Dec 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Feature requests wa-api Issues which need additional features from the World Anvil API in order to become possible.
Projects
None yet
Development

No branches or pull requests

2 participants