在Android Studio中使用Marvel API密钥的方法

huangapple go评论78阅读模式
英文:

Usage Of Marvel API keys in Android Studio

问题

如何在Android Studio中使用Marvel API密钥构建应用程序?我找不到一篇文章能够说明如何在Android Studio中使用Marvel API密钥。

英文:

Can some one tell, that how to use the Marvel API keys in android studio for building an app. I did not find a single article that could tell on how to use the Marvel API keys in android studio.

答案1

得分: 2

简单明了:

  1. https://developer.marvel.com/account 获取 Marvel API 密钥(公钥和私钥)。

  2. 现在你需要一个哈希键来发起请求:

    • 你需要一个 ts 值(例如 1)
    • 生成 md5,连接(ts + 私钥 + 公钥)
  3. 现在,你可以在浏览器中尝试调用 https://gateway.marvel.com/v1/public/characters?apikey=$MARVEL_API_PUBLIC_KEY&ts=$MARVEL_API_TS&hash=$MARVEL_API_HASH

例如:
私钥:qqqq
公钥:wwww
ts:1 -> 在这里你可以选择想要的值

  1. 前往 http://www.md5.cz/ 并输入 qqqqwwww1 以生成 md5 -> 结果: 30db1167f72b3ff7acbbd14df4c1f878
  2. 现在,你可以尝试在浏览器中输入:
    https://gateway.marvel.com/v1/public/characters?apikey=wwww&ts=1&hash=30db1167f72b3ff7acbbd14df4c1f878

如果你正在编写一个 Android 应用程序,你可以在这里找到一个示例:https://github.com/yelotmany/Marvel-Characters

英文:

It's simple:

  1. Get Marvel Api Keys (public and private) from https://developer.marvel.com/account

  2. Now you need a Hash key to make requests:

  • Your will need a ts value (for example 1)
  • Generate md5 concatening (ts + private key + public key)
  1. Now, you can try in the browser calling https://gateway.marvel.com/v1/public/characters?apikey=$MARVEL_API_PUBLIC_KEY&ts=$MARVEL_API_TS&hash=$MARVEL_API_HASH

For example:
Private key: qqqq
Public key: wwww
ts: 1 -> here you can choose the value that you want

  1. Go to http://www.md5.cz/ and put qqqqwwww1 to generate md5 -> result : 30db1167f72b3ff7acbbd14df4c1f878
  2. Now, from browser you can try:
    https://gateway.marvel.com/v1/public/characters?apikey=wwww&ts=1&hash=30db1167f72b3ff7acbbd14df4c1f878

If you are programing an Android App, you found an example here: https://github.com/yelotmany/Marvel-Characters

答案2

得分: 1

Server-side applications must pass two parameters in addition to the apikey parameter:

ts - a timestamp (or other long string which can change on a request-by-request basis)

hash - an md5 digest of the ts parameter, your private key, and your public key (e.g. md5(ts+privateKey+publicKey)

英文:

Server-side applications must pass two parameters in addition to the apikey parameter:

ts - a timestamp (or other long string which can change on a request-by-request basis)

hash - a md5 digest of the ts parameter, your private key and your public key (e.g. md5(ts+privateKey+publicKey)

huangapple
  • 本文由 发表于 2020年7月25日 22:29:17
  • 转载请务必保留本文链接:https://go.coder-hub.com/63089537.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定