Using IFDB's putific API

I have a question about the putific API.

So, I’ve been writing a script to help upload itchio games using this API - the code is at itch_to_ifdb.py · GitHub. I tested this on a local server, which I set up using the instructions at GitHub - iftechfoundation/ifdb: The software behind the Interactive Fiction Database (IFDB), and it works - I can create new listings with test@ifdb.org, and it also works when I create a new user.

However, when trying to use the same script on the actual IFDB (using http://ifdb.org/putific as the api endpoint), it doesn’t work - I get the error “The IFDB login failed: incorrect username or password.”, even though I know the username (email) and password are correct (unrelated but I guess sending passwords over http is a security risk). I also tried https://ifdb.org/putific, and that gets no response.

Is there any reason why it would work in localhost, but not on the server?

4 Likes

I reproduce the issue with https://ifdb.org/putific and I’ve filed it as

I’m investigating now.

2 Likes

It’s fixed! You can test it by pasting this script into Chrome Dev Tools on ifdb.org, changing the username and password to your email address and password. (If you use it as-is, please navigate to the game you created and click “Delete This Page” to clean up the test game you made.)

const body = new FormData();
body.append('username', 'ifdbadmin@ifdb.org');
body.append('password', 'secret');
const xml = `<?xml version="1.0" encoding="UTF-8"?>
<ifindex version="1.0" xmlns="http://babel.ifarchive.org/protocol/iFiction/">
<story>
<bibliographic>
<title>Test ${Date.now()}</title>
<author>Test Author</author>
</bibliographic>
</story>
</ifindex>
`;
body.append('ifiction', new Blob([xml], {type: 'text/xml'}));
body.append('requireIFID', 'no');
const response = await fetch('/putific', {
    method: 'post',
    body,
});
const {status, statusText} = response;
const text = await response.text();
console.log(JSON.stringify({status, statusText, text}, null, 2));
1 Like

I’ve added a few sample scripts to the IFDB Github.

There are three sample scripts there, in Python, Node.js, and Bash/Curl. (The sample scripts also demonstrate how to upload a cover image.)

1 Like