Skip to content
This repository has been archived by the owner on Nov 27, 2018. It is now read-only.

404 on all requests? #53

Closed
dmitrym0 opened this issue Mar 22, 2013 · 21 comments
Closed

404 on all requests? #53

dmitrym0 opened this issue Mar 22, 2013 · 21 comments

Comments

@dmitrym0
Copy link

Hello gentlemen, it appears that every data call that I make results in a 404 error. Authentication appears to be successful though. Any advice?

>> harvest = Harvest.hardy_client('subdomain', 'myemail@subdomain.com', 'secretpassword')
=> #<Harvest::Base:0x10729fe98 @credentials=#<Harvest::Credentials:0x10729fd08 @ssl=true, @subdomain="subdomain", @password="secretpassword", @username="myemail@subdomain.com">>
>> harvest.invoices.all
Harvest::NotFound: Harvest::NotFound : 404
    from /Library/Ruby/Gems/1.8/gems/harvested-0.6.4/lib/harvest/api/base.rb:49:in `request'
    from /Library/Ruby/Gems/1.8/gems/harvested-0.6.4/lib/harvest/api/invoices.rb:30:in `all'
    from (eval):3:in `send'
    from (eval):3:in `all'
    from /Library/Ruby/Gems/1.8/gems/harvested-0.6.4/lib/harvest/hardy_client.rb:59:in `retry_rate_limits'
    from (eval):2:in `all'
    from (irb):7
>> harvest.projects.all
Harvest::NotFound: Harvest::NotFound : 404
    from /Library/Ruby/Gems/1.8/gems/harvested-0.6.4/lib/harvest/api/base.rb:49:in `request'
    from /Library/Ruby/Gems/1.8/gems/harvested-0.6.4/lib/harvest/behavior/crud.rb:8:in `all'
    from (eval):3:in `send'
    from (eval):3:in `all'
    from /Library/Ruby/Gems/1.8/gems/harvested-0.6.4/lib/harvest/hardy_client.rb:59:in `retry_rate_limits'
    from (eval):2:in `all'
    from (irb):8
@prsimp
Copy link
Contributor

prsimp commented Apr 11, 2013

Hey @dmitrym0, sorry for the delayed response, but are you still experiencing this issue?

@prsimp
Copy link
Contributor

prsimp commented Apr 18, 2013

@dmitrym0 This seems like it's more likely a problem on the Harvest side or an issue with your connection. Closing for now. If this issue is persisting for you, you can re-open with some more info (trace route to the domain etc.).

@prsimp prsimp closed this as completed Apr 18, 2013
@dmitrym0
Copy link
Author

It's still happening, @prsimp. Do you think it's something related to the way my particular harvest subdomain is setup?

@prsimp prsimp reopened this Apr 18, 2013
@prsimp
Copy link
Contributor

prsimp commented Apr 18, 2013

@dmitrym0 what subdomain are you using for the actual request that is 404ing?

Can you paste the output of a trace route to http://<your_subdomain>.harvestapp.com ?

@dmitrym0
Copy link
Author

Looks like you're right. I'm having trouble tracerouting to this domain, but it works fine in the browser. Must be a proxy config issue or something.

@prsimp prsimp closed this as completed Apr 18, 2013
@dmitrym0
Copy link
Author

Paul, sorry to bother you again:

dmitry@bees:~/work$ traceroute REDACTED.harvestapp.com
traceroute to REDACTED.harvestapp.com (72.251.221.105), 30 hops max, 60 byte packets
 1  DD-WRT (192.168.1.254)  0.307 ms  0.335 ms  0.430 ms
 2  * * *
 3  tl8fl.vs.shawcable.net (64.59.147.153)  43.702 ms  43.700 ms  43.692 ms
 4  66.163.68.201 (66.163.68.201)  39.511 ms  39.513 ms  39.505 ms
 5  rc1sj-pos0-0.cl.shawcable.net (66.163.77.70)  63.776 ms  63.776 ms  63.769 ms
 6  equinix-ix.sjc1.us.voxel.net (206.223.116.4)  73.564 ms  71.277 ms  71.708 ms
 7  3890.te6-2.tsr1.lga3.us.voxel.net (173.231.161.93)  118.005 ms  115.969 ms  119.965 ms
 8  0.ae59.tsr1.lga5.us.voxel.net (208.122.44.202)  132.585 ms  128.549 ms  128.547 ms
 9  0.ae57.csr2.lga6.us.voxel.net (208.122.44.210)  122.040 ms  101.932 ms  108.094 ms
10  lb3.harvestapp.com (72.251.221.105)  107.764 ms  97.988 ms  104.739 ms

Script 1:

Wrong password.

require 'harvested'

harvest = Harvest.client('REDACTED.harvestapp.com', 'username', 'wrongpassword')
harvest.projects.all   # list out projects

Execution:

dmitry@bees:~/work$ ruby1.9.1 harvest.rb
/var/lib/gems/1.9.1/gems/harvested-0.6.4/lib/harvest/api/base.rb:47:in `request': Harvest::AuthenticationFailed : 401 Authentication failed for API request. (Harvest::AuthenticationFailed)
        from /var/lib/gems/1.9.1/gems/harvested-0.6.4/lib/harvest/behavior/crud.rb:8:in `all'
        from harvest.rb:4:in `<main>'

Script 2:

Correct password:

require 'harvested'

harvest = Harvest.client('REDACTEDi.harvestapp.com', 'username', 'rightpassword')
harvest.projects.all   # list out projects

Execution:

dmitry@bees:~/work$ ruby1.9.1 harvest.rb
/var/lib/gems/1.9.1/gems/harvested-0.6.4/lib/harvest/api/base.rb:49:in `request': Harvest::NotFound : 404   (Harvest::NotFound)
        from /var/lib/gems/1.9.1/gems/harvested-0.6.4/lib/harvest/behavior/crud.rb:8:in `all'
        from harvest.rb:4:in `<main>'

@zmoazeni
Copy link
Owner

@dmitrym0 Have you tried a simple curl-based who_am_i yet? http://www.getharvest.com/api/authentication-http-basic

@sar1248
Copy link

sar1248 commented May 22, 2013

I had this issue and resolved it by having my Harvest user account promoted to an administrator.

@moughxyz
Copy link

I am having this same issue. However I do not have the option to promote myself to an administrator. Is there an alternative? Why must I be an administrator?

@zmoazeni
Copy link
Owner

Certain API actions require administrative actions (either as a Project Manager or an Admin). Viewing Invoices is one of those.

As a regular user, you should be able to track time. Not sure if there is anything else available offhand. Perhaps a few reporting utilities.

@moughxyz
Copy link

All I'm trying to do is:

 harvest = Harvest.client(subdomain, email, pass)
 projects = harvest.projects.all

and I get the 404 error. I have made sure the credentials are valid by harvest.credentials.valid? and it checks out.

Also doing harvest.account.who_am_i works fine and returns all the proper information. Just nothing else works.

@zmoazeni
Copy link
Owner

Viewing projects requires Project Manager or Admin privileges. You get the same thing by logging in as the user in the web interface.

This is not Harvested behavior or an issue of the bindings. It is playing by the rules of the Harvest API.

@moughxyz
Copy link

Ya you're right. I thought that since when adding time entries I could add to a certain project, that I could view projects as well. It did work for harvest.time.all.

@moughxyz
Copy link

So when creating a time entry, it requires me to pass in a project id:

time_entry = Harvest::TimeEntry.new(:notes => 'Bottled glue today', :hours => 8, :spent_at => "04/11/2010", :project_id => project.id, :task_id => task_assignment.task_id)
time_entry = harvest.time.create(time_entry)

However, since I don't have access to view projects, how will I be able to determine project id? The web interface has a drop down when creating a time entry that allows me to select a project by name. Is there something similar I can do here, i.e getting all project names that I have access to and their ids?

@moughxyz
Copy link

@zmoazeni any ideas?

@zmoazeni
Copy link
Owner

@mobitar I don't off hand. You may have to scrape the ID from a URL or markup as the user. That's a crappy solution, but I don't have any ideas how you could do that from the API.

@aford3
Copy link

aford3 commented Nov 1, 2013

@mobitar I am in the same situation as you, was curious if you made any progress or found it to be a dead end without admin access.

@moughxyz
Copy link

moughxyz commented Nov 1, 2013

Which part are you referring to?

@aford3
Copy link

aford3 commented Nov 1, 2013

Grabbing a project id without admin access.

@moughxyz
Copy link

moughxyz commented Nov 1, 2013

@aford3
Copy link

aford3 commented Nov 1, 2013

Thank you! This looks great.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants