Scanning Book's ISBN number

Viewing 8 reply threads
  • Author
    Posts
  • October 17, 2019 at 6:02 PM #37208

    Matthew Johnson
    Participant

    Has anyone successfully made any templates that have scripted-in the ability to simply scan a book’s ISBN number and it fetches all of the book’s info and autofills out the form? I’m a compete beginner with Java, so that may be a bit much for a first time Java project. This could speed up the process of keeping a record of all of our books a bit easier.

    I think Brendan posted a script that worked this way for movies, and it worked rather well (except for the photo field), once I pasted my Field ID’s into the right spots. I haven’t seen anyone do this yet with ISBN though.

    October 17, 2019 at 6:16 PM #37209

    Daniel Leu
    Participant

    Hmm… I never tried. Could be a fun project. BTW, the script language is called javascript. Java is a totally different programming language.

    To get started, you might want to take the movies example and adjust it to work with the books api at https://openlibrary.org/dev/docs/api/books.

    October 17, 2019 at 7:37 PM #37210

    Daniel Leu
    Participant

    This was a fun little project. It looks like the ISBN record is not the same for all books. Specially foreign books. So maybe there are other foreign reverse ISBN services that provide better infos.

    var isbn_id = 'fld-274d1f7125404b6fb066fab21f67f834';
    var title_id = 'fld-f46fd341844849b1ad91d8c20712cefb';
    var subtitle_id = 'fld-cb24da764ce644bea8a24decef8146ce';
    var author_id = 'fld-67a6fcecfce945d0ba16fcb5b5e63001';
    var published_date_id = 'fld-672306e2df2f42488e2d1975df1de3e3';
    var url_id = 'fld-aaa8aa064e43416f80318a0a9e3a2470';
    var thumbnail_url_id = 'fld-8eeba1cd75c84555a51fe7f0dd273dcf';
    var description_id = 'fld-23b3241169fb41829b4cc26852dae873';
    var thumbnail_id = 'fld-41d3474969ba4a21ae5360148cf5444b';
    
    function fetchProductInfo(isbn) {
    	var url = 'https://www.googleapis.com/books/v1/volumes?q=isbn:' + isbn + '&format=json';
    	var product_info = Utils.getJsonFromUrl(url);
    	return product_info;
    }
    
    function Get_Isbn(isbn) {
    
    	var info = fetchProductInfo(isbn);
    	
    	// there should be only one book
    	if (info['totalItems'] == 1){
    		var book_info = info['items'][0]['volumeInfo'];
    		
    		//console.log(JSON.stringify(book_info, null, 2));
    				
    		record.setFieldValue(title_id, book_info['title']);
    		record.setFieldValue(subtitle_id, book_info['subtitle']);
    		var authors = book_info['authors'].join(', ');
    		record.setFieldValue(author_id, authors);
    		record.setFieldValue(published_date_id, book_info['publishedDate']);
    		record.setFieldValue(url_id, book_info['canonicalVolumeLink']);
    		record.setFieldValue(thumbnail_url_id, book_info['imageLinks']['thumbnail']);
    		record.setFieldValue(description_id, book_info['description']);
    		record.addPhotoFromUrlToField(book_info['imageLinks']['thumbnail'],thumbnail_id);
    		document.saveAllChanges();
    
    	} else {
    		Utils.alertWithMessage("Get_Isbn", "Fetched " + info['totalItems'] + " instead of 1. Aborting");
    	}
    	
    }
    
    Get_Isbn(record.getFieldValue(isbn_id));

    Attached is the template.

    Attachments:
    You must be logged in to view attached files.
    October 18, 2019 at 8:00 AM #37219

    Matthew Johnson
    Participant

    Daniel, That’s amazing!

    Daniel,
    Thank you!
    I’m amazed how quickly you just whipped that up!

    I got interest from my 6 year old daughter to catalog her books… but she was discouraged by how much time it would take to type it all in. She was excited to see your script in action this morning! Seeing this script in action gave me an idea to take it a step further and make it a one of a kind tool that could help educators.

    Now let me ask this… Many elementary schools in the US in order to classify books based on it’s reader’s ability to read and their known vocabulary, are identified by it’s “AR level”. The company that started this is called Accelerated Reader. They have a website to enter info about the book,
    ARbookfind link
    and it will tell you what it’s “AR number” is. From reading up on this a bit… this platform does not have an API, and the site uses cookies, so from what i’ve been reading this is a big problem… but I’m not as savvy on the scripting and programming side of things as I wish I were. If someone could add to Daniel’s script a field that provides the “AR level” number, this app could be extremely useful to almost any elementary school teacher, as well as Librarians in the US.

    Being able to Print out Labels with the AR Level on them would be a huge win for teachers… so If anyone is willing to take a poke at this and can get it working… I’ll gladly share this with with the teachers at the school I work at. I can get instant feedback from them as well. Many use alternative database software to check books out of their rooms to students to take home… but none of them have a built in AR level field… so Tapforms I believe would be the first to have that… and when Teachers find useful tools they show them to their colleagues.

    I love this community that Brendan set up for us. This has been exteremely helpful.
    Thanks again Daniel!

    October 18, 2019 at 9:56 AM #37220

    Daniel Leu
    Participant

    You are welcome, Matthew. It was fun. But getting the AR Level infos might be a bit more challenging…

    And then there is the legalese: “Additionally, you agree not to: …. Use any robot, spider or other automatic device, process or means to access the Website for any purpose, including monitoring or copying any of the material on the Website.”

    Anyway, I found a project that provides a way to get some infos. It is a bit old: https://github.com/anthonator/ar-book-finder. It is not directly applicable to what you want right now, but it might be a pointer to someone else.

    Good luck!

    July 24, 2023 at 8:39 AM #49722

    Patrick Lusch
    Participant

    Can’t seem to get the template to work. Has the script URL changed since this was made?

    July 24, 2023 at 9:50 AM #49723

    Daniel Leu
    Participant

    Still works for me. I entered the ISBN number then clicked on ‘Recalculate formulas’ and the result showed up.

    This is the number I used: 9781930238299

    July 27, 2023 at 1:19 PM #49727

    Patrick Lusch
    Participant

    Thanks @Daniel_Leu. I can get it to look up your example ISBN, so it must be sensitive to real niche type books. I can see the results in the console log, but am I correct that this script should populate the fields with the results? I can’t seem to make it do that. Maybe I am looking in the wrong spot on the script to make it match the names of my fields?

     

    Thanks

    July 27, 2023 at 1:47 PM #49730

    Daniel Leu
    Participant

    The form script is an example on how to fetch the data. It doesn’t populate the fields.

    There is a field script that uses the ISBN number as input and populates the fields of the given record. Enter the ISBN number a new record and click on “recalculate formulas” or cmd-r to get it executed. This will populate all fields of the record including the cover image.

    Can you give the ISBN number of one of your books you’re trying?

Viewing 8 reply threads

You must be logged in to reply to this topic.