jaredcowing / wmsNewBooks

Small program to view list of new books by fund & date acquired using WorldShare Acquisitions API.
MIT License
2 stars 1 forks source link

Copies not loading due to non-conforming header in oclcTransmit #12

Closed gjerdery closed 2 years ago

gjerdery commented 2 years ago

Sometime after March 23, 2022, we discovered that copies were not being successfully loaded into our database. The acquisitions API was successful in harvesting order item details, but the WMS Collection Management API was not returning copy details.

I found that the Collection Management API was returning a 400 error, reporting that the header passed by the oclcTransmit function was not conforming to RFC 7230. Other forums indicate that this could be related to passing a non-encoded character in the header. In the string passed to Collection Management, there is a colon in $resourceURLp2. Encoding this variable resolved my error. I did this be updating ln 630 of Bookfeed.php from this:

$header=array("GET ".$resourceURLp2." HTTP/1.1","Accept: application/json",$authForHeader);

to this:

$header=array("GET ". urlencode($resourceURLp2)." HTTP/1.1","Accept: application/json",$authForHeader);

It isn't clear if something changed on the OCLC side to cause stricter enforcement of RFC 7230 conformity, or if this is an issue local to my server.

jaredcowing commented 2 years ago

Thank you for reporting and resolving this issue! I will update the repo with your fix.