Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Api App #2624

Closed
xennn opened this issue Jul 8, 2019 · 9 comments
Closed

Api App #2624

xennn opened this issue Jul 8, 2019 · 9 comments

Comments

@xennn
Copy link

xennn commented Jul 8, 2019

Hello,

i want to interact with the api.
i create a app and App Code. App Security is SSL with App code token.
But if i try to login without success.

curl -X POST -u user:pass https://ipam/api/grabnetworks/user/ -i -k
HTTP/1.1 404 Not Found
Date: Mon, 08 Jul 2019 12:29:25 GMT
Server: Apache/2.4.29 (Ubuntu)
Content-Length: 306
Content-Type: text/html; charset=iso-8859-1

<title>404 Not Found</title>

Not Found

The requested URL /api/grabnetworks/user/ was not found on this server.


Apache/2.4.29 (Ubuntu) Server at ipam Port 443

if i try only with api i get this:

curl -X POST -u user:pass https://ipam/api/ -i -k
HTTP/1.1 400 Bad Request
Date: Mon, 08 Jul 2019 14:13:29 GMT
Server: Apache/2.4.29 (Ubuntu)
Set-Cookie: phpipam=ut7vbptpc4uq5og7uonvb66691; expires=Tue, 09-Jul-2019 14:13:29 GMT; Max-Age=86400; path=/; HttpOnly
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-cache
Pragma: no-cache
Content-Length: 72
Connection: close
Content-Type: application/json; charset=utf-8

{"code":400,"success":false,"message":"Invalid application id","time":0}

Whats wrong here?
...

@zombah
Copy link
Contributor

zombah commented Jul 8, 2019

SSL with App code token is auth with static token, no need to try to generate dynamic token with user/pass auth. Example to get list of sections with app code token:

curl -X GET https://phpipam.example.com/api/your-app-id-here/sections/ -i --header 'token: Your-app-code-here'

@xennn
Copy link
Author

xennn commented Jul 8, 2019

Its not working for me :(

curl -X GET https://ipam/api/grab/sections/ --header "token: y8e7INqJ6uFyFOhaX6kZFwvQptTjWsOq" -i -k
HTTP/1.1 404 Not Found
Date: Mon, 08 Jul 2019 20:01:57 GMT
Server: Apache/2.4.29 (Ubuntu)
Content-Length: 301
Content-Type: text/html; charset=iso-8859-1

<title>404 Not Found</title>

Not Found

The requested URL /api/grab/sections was not found on this server.


Apache/2.4.29 (Ubuntu) Server at ipam Port 443

@zombah
Copy link
Contributor

zombah commented Jul 8, 2019

Hm, check app-id is correct and apache mod_rewrite is enabled

@xennn
Copy link
Author

xennn commented Jul 9, 2019

Its enabled :/

/etc/apache2/mods-enabled # a2enmod rewrite
Module rewrite already enabled

any Ideas?

@zombah
Copy link
Contributor

zombah commented Jul 9, 2019

Maybe prettify links setting is also required, check your administration settings.
If not it then something on web front but no ideas, try to dig your logs maybe some clues where, because wrong app-id also have correct answer here like {"code":400,"success":false,"message":"Invalid application id","time":0.001}

@xennn
Copy link
Author

xennn commented Jul 9, 2019

Pretty Links is allready enabled. The Vhost settings are correct...I try to find something in logs

@zombah
Copy link
Contributor

zombah commented Jul 9, 2019

Check via this guide also https://phpipam.net/documents/prettified-links-with-mod_rewrite/
Maybe you defined wrong BASE or something missing in apache config

@globalpayments-patrick-gemme
Copy link

globalpayments-patrick-gemme commented Sep 26, 2019

@xennn I had the same issue with making API calls and only getting 404's. I ended up adding the directory to the apache2.conf. The /var/www directory was there, but not the /var/www/html directory (which is where I installed phpipam). Now it's working for me.

<Directory "/var/www/html">
Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
>

@ultramekon
Copy link

Thanks fella, I was missing the same. Adding the directory to apache2.conf fixed it for me 👍

@xennn xennn closed this as completed Dec 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants