Skip to content

WhatPulse badges don't work due to deprecated API #11908

@jNullj

Description

@jNullj

🕚 When did the problem start?

I noticed first in tests for PR #11898

📷 Live badge


This example is our example in the docs

🔧 Is the live badge working?

live badge does not work
https://img.shields.io/whatpulse/keys/team/179734

🐞 Stack trace

    4) 
        [ GET /download/team/1295.json ]
    [live] WhatPulse team as team id, upload
 Service class  👩‍🍳 
 WhatPulse
 Named params  🎫 
 { metric: 'upload', userType: 'team', id: '1295' }
 Query params  🖍 
 {
  color: undefined,
  colorA: undefined,
  colorB: undefined,
  label: undefined,
  labelColor: undefined,
  link: undefined,
  logo: undefined,
  logoColor: undefined,
  logoSize: undefined,
  rank: undefined,
  style: undefined
}
 Query params after validation  🛁
{ rank: undefined }
 Query params after validation  🖍 
 {
  color: undefined,
  colorA: undefined,
  colorB: undefined,
  label: undefined,
  labelColor: undefined,
  link: undefined,
  logo: undefined,
  logoColor: undefined,
  logoSize: undefined,
  rank: undefined,
  style: undefined
}
 Request  🏹 
 https://api.whatpulse.org/team.php?team=1295&format=json
{
  "headers": {
    "Accept": "application/json",
    "User-Agent": "shields (self-hosted)/dev"
  }
}
 Response status code  🎯 
 200
 Response JSON (unparseable)  🎯 
 <?xml version="1.0"?>
<WhatPulse><error>This API has been deprecated, please use the new API. More info here: https://whatpulse.org/help/api/web/intro</error></WhatPulse>

 Handled error  🙅 
 SyntaxError: Unexpected token '<', "<?xml vers"... is not valid JSON
    at JSON.parse (<anonymous>)
    at parseJson (file:///home/jnullj/code/shields/core/base-service/json.js:10:17)
    at WhatPulse._parseJson (file:///home/jnullj/code/shields/core/base-service/base-json.js:21:12)
    at WhatPulse._requestJson (file:///home/jnullj/code/shields/core/base-service/base-json.js:69:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:103:5)
    at async WhatPulse.fetch (file:///home/jnullj/code/shields/services/whatpulse/whatpulse.service.js:83:12)
    at async WhatPulse.handle (file:///home/jnullj/code/shields/services/whatpulse/whatpulse.service.js:129:18)
    at async WhatPulse.invoke (file:///home/jnullj/code/shields/core/base-service/base.js:447:23)
    at async Object.handler (file:///home/jnullj/code/shields/core/base-service/base.js:493:31) {
  prettyMessage: 'unparseable json response',
  cacheSeconds: undefined,
  response: undefined
}
 Service data  🛡 
 {
  isError: true,
  message: 'unparseable json response',
  color: 'lightgray'
}
 Response  🛡 
 {
  label: 'whatpulse',
  message: 'unparseable json response',
  color: 'lightgrey',
  link: [],
  name: 'whatpulse',
  value: 'unparseable json response'
}

💡 Possible solution

New API can be found here but is now using a bearer token for all requests.
Using an API key we still can access public data.
The rate limit is 1000 requests/h and we have a remaining feedback.
Considering they cache for 1h, we can do the same.
The new.
Looking at our matrices it seems we had only 13 server facing requests in the last 24h.

overall using the new API seems like a sound solution so far.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions