Page 3 of 5

Re: ZXDB based Open API

Posted: Sun Sep 23, 2018 1:02 pm
by Turrican
Hi Thomas.
Is the api in the magazine search case sensitive?
If you type "your spectrum" there is no result but "Your Spectrum" works.
In the general search the lower case works ok.
Thanks.

Re: ZXDB based Open API

Posted: Sat Oct 06, 2018 8:19 am
by kolbeck
Hi,

Sorry for not seeing this!! (looks like I'm not getting any SC notifications at all).

In general ZXInfo API is case-insensitive, but as magazine was added later I might have forgot to do it properly. I will have a look at let you know

Re: ZXDB based Open API

Posted: Fri Oct 12, 2018 11:27 pm
by kolbeck
Hello [mention]Turrican[/mention] ,

Still working on this. Since the API has not been updated for quite some time, updating and getting to compile is not a trivial task - but i'm working on it and will keep you updated. In the mean time, which API endpoint do you use for the search?

BTW: Got an Android phone in my hand for the first time, and your app was the first installed - great work!

cheers
/Thomas

Re: ZXDB based Open API

Posted: Sun Oct 14, 2018 11:35 pm
by Turrican
kolbeck wrote: Fri Oct 12, 2018 11:27 pm Hello @Turrican ,

Still working on this. Since the API has not been updated for quite some time, updating and getting to compile is not a trivial task - but i'm working on it and will keep you updated. In the mean time, which API endpoint do you use for the search?

BTW: Got an Android phone in my hand for the first time, and your app was the first installed - great work!

cheers
/Thomas
Hi Thomas.
I´m using 2:
1-) /v2/search for General List
2-) /v2/magazines/{magazine-name}/issues for Magazine Search.

Regards!

Re: ZXDB based Open API

Posted: Mon Oct 15, 2018 8:59 pm
by PeterJ
kolbeck wrote: Sat Oct 06, 2018 8:19 am Sorry for not seeing this!! (looks like I'm not getting any SC notifications at all).

Hi Thomas, could you try resubscribing to the topic? I checked and emails are being sent out to other users. Let me know if you still have issues.

Peter

Re: ZXDB based Open API

Posted: Wed Nov 21, 2018 11:01 am
by kolbeck
Turrican wrote: Sun Oct 14, 2018 11:35 pm ...
Hi Thomas.
I´m using 2:
1-) /v2/search for General List
2-) /v2/magazines/{magazine-name}/issues for Magazine Search.

Regards!
OK - 2) is not a search function, but more a lookup. The idea back then was to use the list of magazines e.g. https://api.zxinfo.dk/api/zxinfo/v2/mag ... 0&offset=0 - and then use the name from here to do a specific lookup.

That said, I like the idea of a magazine oriented search, if you have any input let me know :-)

/Thomas

Re: ZXDB based Open API

Posted: Fri Nov 30, 2018 10:59 am
by Turrican
kolbeck wrote: Wed Nov 21, 2018 11:01 am
Turrican wrote: Sun Oct 14, 2018 11:35 pm ...
Hi Thomas.
I´m using 2:
1-) /v2/search for General List
2-) /v2/magazines/{magazine-name}/issues for Magazine Search.

Regards!
OK - 2) is not a search function, but more a lookup. The idea back then was to use the list of magazines e.g. https://api.zxinfo.dk/api/zxinfo/v2/mag ... 0&offset=0 - and then use the name from here to do a specific lookup.

That said, I like the idea of a magazine oriented search, if you have any input let me know :-)

/Thomas
Oh! I´m using it directly with the input from user. That´s why it´s working as case sensitive so. :)

Re: ZXDB based Open API

Posted: Fri Nov 30, 2018 11:53 am
by kolbeck
Hi,

I'm working on a new "Magazine Search" function, will let you know when it's ready :-)

/Thomas

Re: ZXDB based Open API

Posted: Fri Nov 30, 2018 4:39 pm
by PeterJ
Has anyone used the API with Python? I'm struggling.

Re: ZXDB based Open API

Posted: Fri Nov 30, 2018 5:30 pm
by kolbeck
PeterJ wrote: Fri Nov 30, 2018 4:39 pm Has anyone used the API with Python? I'm struggling.
Have you tried postman? It can generate python code snippets.

/Thomas

Re: ZXDB based Open API

Posted: Sat Dec 01, 2018 11:31 pm
by kolbeck
[mention]Turrican[/mention] - I've added a /magazine/search method to the API, please try it out - https://api.zxinfo.dk/doc/

/Thomas

Re: ZXDB based Open API

Posted: Sun Dec 02, 2018 10:06 am
by Turrican
kolbeck wrote: Sat Dec 01, 2018 11:31 pm @Turrican - I've added a /magazine/search method to the API, please try it out - https://api.zxinfo.dk/doc/

/Thomas
Ok. Thank you!

Re: ZXDB based Open API

Posted: Tue Dec 04, 2018 6:53 pm
by Turrican
kolbeck wrote: Sat Dec 01, 2018 11:31 pm @Turrican - I've added a /magazine/search method to the API, please try it out - https://api.zxinfo.dk/doc/

/Thomas
Hi Thomas.
I´m using the magazine search in a different way.
This new method shows all magazines (only one line, with basic info) with all words that I input, right?
The app lists all magazines issues with the same name in the input field. :)

So in the new method if I input "your sinclair" it shows "Your Sinclair", "Sinclair User", "Your Spectrum", etc...
How my search works:
When I input "Your Sinclair" it shows all Your Sinclair issues with cover images. The problem here is that it is case sensitive.
Thank you.

Re: ZXDB based Open API

Posted: Tue Dec 04, 2018 8:25 pm
by kolbeck
ahh.. ok - in general REST URLs are case sensitive. The idea was that a client, in this case your app, used the magazine list or the new search to find the exact magazine name - but in this case I think an exception could be made.

The following should now work and return the same result:
https://api.zxinfo.dk/api/zxinfo/v2/mag ... ir/issues/
https://api.zxinfo.dk/api/zxinfo/v2/mag ... ir/issues/
https://api.zxinfo.dk/api/zxinfo/v2/mag ... ir/issues/

/Thomas

Re: ZXDB based Open API

Posted: Tue Dec 04, 2018 9:39 pm
by Turrican
kolbeck wrote: Tue Dec 04, 2018 8:25 pm ahh.. ok - in general REST URLs are case sensitive. The idea was that a client, in this case your app, used the magazine list or the new search to find the exact magazine name - but in this case I think an exception could be made.

The following should now work and return the same result:
https://api.zxinfo.dk/api/zxinfo/v2/mag ... ir/issues/
https://api.zxinfo.dk/api/zxinfo/v2/mag ... ir/issues/
https://api.zxinfo.dk/api/zxinfo/v2/mag ... ir/issues/

/Thomas

Danke!

Re: ZXDB based Open API

Posted: Wed Jan 16, 2019 6:27 pm
by PeterJ
I set myself a goal for January.. I wanted to get started with Python and JSON. I have never used either of these technologies before (so treat me gently!). I thought the best way to approach this would be to use the excellent API from [mention]kolbeck[/mention].

This will never win any awards, but shows how relatively straightforward it is to get information out of the API using standard Python modules. The beauty of Python is that it's multi-platform. So I have it running on my Windows 10 machine, my Ubuntu box and the Raspberry Pi. I'm hoping to be able to add a GUI using tkinter in the future, and of course allow users to search for a title. When I have something half decent I will add it onto the Spectrum Computing GutHub page.

I did originally try learning C# but it blew my mind!

Code: Select all

import json
import urllib.request

data = urllib.request.urlopen("https://api.zxinfo.dk/api/zxinfo/games/0005671?mode=compact").read().decode('utf8')

output = json.loads(data)

id = output ['_id']
fulltitle= output ['_source']['fulltitle']
type=output ['_source']['type']
machinetype=output ['_source']['machinetype']
messagelanguage=output ['_source']['messagelanguage']
yearofrelease=output ['_source']['yearofrelease']
originalpublisher=output ['_source']['publisher'][0]['name']
print ('ID:\t\t',id)
print ('Full Title:\t',fulltitle)
print ('Genre:\t\t',type)
print ('Machine Type:\t',machinetype)
print ('Message Language:\t',messagelanguage)
print ('Year of Release:\t',yearofrelease)
print ('Original Publisher:\t',originalpublisher)
print ('')
print ('Control Options:')
for item in output['_source']['controls']:
        controls=item ['control']
        print(controls)
print ('')
print ('Roles:')
for item in output ['_source']['roles']:
	roles_name=item ['name']
	roles_role=item ['role']
	print (roles_name,':\t',roles_role)
print ('')
print ('Authors:')
for item in output  ['_source']['authors']:
	aname=item ['authors'][0]['name']	
	print (aname)
 
Image

Re: ZXDB based Open API

Posted: Wed Jan 16, 2019 8:31 pm
by Turrican
It seems to be easy!
Much more than what I have done in Android.
Good work. :mrgreen:

Re: ZXDB based Open API

Posted: Thu Jan 17, 2019 10:48 am
by 4thRock
I love Python because it allows you to write friendly code. :D
Things are logical and the outcomes are predictable.
Very easy to debug just by looking at the code.
One day I'd like to try on a Web server. I think it might be a good alternative to PHP.

Peter, you should look at Python "dictionaries" to manage the data coming from the queries.
Or arrays of arrays ;)

Re: ZXDB based Open API

Posted: Thu Jan 17, 2019 10:58 am
by PeterJ
Thanks [mention]4thRock[/mention]

I will take a look at dictionaries on the online resources I'm using.

Peter

Re: ZXDB based Open API

Posted: Thu Jan 17, 2019 3:22 pm
by 4thRock
This is self explanatory:

Code: Select all

thisdict =	{
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
x = thisdict["model"]
print(x)
You get Mustang as expected.

I'm sure you will enjoy your reading!

Re: ZXDB based Open API

Posted: Tue Feb 05, 2019 1:08 pm
by kolbeck
Hi

Website and API updated to latest ZXDB (Feb 03 - 2019)

API now returns additional prices, if available, on each release - as a result of internal re-structuring of ZXDB on prices.

/Thomas

Re: ZXDB based Open API

Posted: Tue Feb 05, 2019 1:36 pm
by Einar Saukas
Thank you!

Re: ZXDB based Open API

Posted: Thu Feb 07, 2019 2:48 pm
by druellan
kolbeck wrote: Tue Feb 05, 2019 1:08 pm Website and API updated to latest ZXDB (Feb 03 - 2019)
Thanks!
BTW, I'm getting some broken images for the MIA games, but also for not-so-popular ones that actually have a screenshot. Tested on Chrome and Firefox.

Image

The problem seems related to the in.game screens

Image

Re: ZXDB based Open API

Posted: Thu Feb 07, 2019 3:28 pm
by kolbeck
It’s a known issue- I’m working on it :-)

/T

Re: ZXDB based Open API

Posted: Mon Feb 11, 2019 10:44 pm
by kolbeck
[mention]druellan[/mention] - images should be working again

/T