Issue 171 May Have Been Prematurely Closed

Issue No. 178

Type

Bug

Status

Closed

Reported By

Mark Hughes

Component

API

Resolution

Not a Bug

Votes

0

Created

8/Jul/14 11:13 AM EDT

Closed

8/Jul/2014 2:33 PM EDT

Description

Issue 171 reports a forbidden error when attempting to use the api. It is dated July 7. Something changed around July 6 with the API. My code worked fine until on July 5 but on July 6 started to return a forbidden error when attempting to retrieve this link: <a href="/mlb/standings.json">/mlb/standings.json</a> The link works fine in a standard browser (my perl code uses Mechanize.) Looking at my code, I can see that I have been using neither a custom browser string nor an api token. The code I am using is based on code I started using over a year ago, and I haven't changed it all since April. I would try using an api token, but if I was sent one a year ago, I don't know how to retrieve it. I can, of course, modify the browser id if that's an issue.

Closing Comment

Hi Mark, Please follow the user agent guidelines listed at <a href="/api#ua">/api#ua</a> Generic user agent strings such as PHP/5.3, Java/1.5, python-requests, Mozilla/5.0, etc. are... forbidden. A more helpful error handler has been added on the backend to aid in troubleshooting problems and errors. See <a href="/api/objects/xmlstats-error">/api/objects/xmlstats-error</a>. Check out the Java example <a href="/api/examples#examplehttpclient">/api/examples#examplehttpclient</a> to see how this is used in practice. Everyone is encouraged to check the HTTP status code for &quot;200 OK&quot; and proceed normally, or for 4xx or 5xx status codes, consume the HTTP response body as an Xmlstats Error object.

Comments

1. Mark Hughes 8/Jul/2014 at 11:15 AM EDT

Formerly one didn't need an api token to retrieve standings. Perhaps that has changed?

2. Mark Hughes 8/Jul/2014 at 11:31 AM EDT

So, I recoded and am sending the useragent string again, but I'm still getting the forbidden error.

3. Mark Hughes 8/Jul/2014 at 11:32 AM EDT

Oh, and I figured out how to get a new api token. Thanks.

4. Mark Hughes 8/Jul/2014 at 11:37 AM EDT

Okay. I surrender. It's working again. Perhaps it was the useragent string? Sorry for the bother and thanks for all your work.