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

Use New API URL #196

Closed
ejunker opened this issue Nov 27, 2024 · 8 comments
Closed

Use New API URL #196

ejunker opened this issue Nov 27, 2024 · 8 comments

Comments

@ejunker
Copy link

ejunker commented Nov 27, 2024

OneSignal has a new base API URL

According to their API documentation:

Make sure your API requests are using https://api.onesignal.com and not the legacy https://onesignal.com/api/v1/ URL.

It looks like this would need to be updated in OneSignalClient.php

@mass5
Copy link
Contributor

mass5 commented Jan 11, 2025

my #197 PR should fix this

@lcon91
Copy link

lcon91 commented Jan 21, 2025

I think this feature should be resolved with an optional variable, avoiding problems with using ^2.x composer.
This change broke my homolog environment. Fortunately, it did not got to production.
If people using this lib have to change it's own environment, it is not a minor change.

@mass5
Copy link
Contributor

mass5 commented Jan 21, 2025

Thanks for the feedback @lcon91 I'm glad you found a way to fix your issue.
Are you aware that on the 1st of March 2025 all the legacy user API keys will be deprecated? What this means is that if you don't update your keys with the new URL, it will stop working. From what I understand, you have 1 month left. Is this correct? Can you confirm?

@lcon91
Copy link

lcon91 commented Jan 21, 2025

Actualy I wasn't, but there's a way to work with this solution without having to force a new variable in environment.
The const that had been removed might be changed with the new URL and then could've been used an optional parameter in the constructor or, even better, inside the constructor it could've been used a variable that use the env variable OR use the const when the env var didn't exist.

For this solution, the new lib version had to be 3.0, since it require a new environment variable (breaking change)

@mass5
Copy link
Contributor

mass5 commented Jan 23, 2025

Thanks for the review @lcon91
I tried to make this as flexible as possible so if people are still using the old URL they can use the new code but set up their old URL in the .env settings to override the value.
One more thing, even if you are missing the .env value, the code has a default URL set in the config file /config/onesignal.php

'rest_api_url' => env('ONESIGNAL_REST_API_URL', 'https://api.onesignal.com'),

Does this answer your question?

@lcon91
Copy link

lcon91 commented Jan 23, 2025

Actually, it has now, in the 2.3 version. Before this, it didn't have any workaround. That's why it is a breaking change.
I don't have any question. Just a feedback.

@throcha3
Copy link
Contributor

throcha3 commented Feb 3, 2025

Fixed in the 2.4 release, guys! Thanks everyone

@berkayk berkayk closed this as completed Feb 4, 2025
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

5 participants