AstronomyAPI / Samples

Examples for Astronomy API
https://astronomyapi.com
MIT License
30 stars 3 forks source link

403 forbidden #75

Open barakforkids opened 4 weeks ago

barakforkids commented 4 weeks ago

i'm tring to connect from .net web form, thats the header i'm sending, and get 403, what can fix it? client.Headers.Add("Authorization: Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(ApplicationId + ":" + ApplicationSecret)));

astroanu commented 3 weeks ago

I'm not a .net programmer, but if you have the headers correctly you should have access. Did you try hardcoding the base64 code to the header?

barakforkids commented 3 weeks ago

Tried menualy hardcoded and code on runtime, both returns 403.

‫בתאריך יום ו׳, 16 באוג׳ 2024 ב-13:45 מאת ‪astroanu‬‏ <‪ @.***‬‏>:‬

I'm not a .net programmer, but if you have the headers correctly you should have access. Did you try hardcoding the base64 code to the header?

— Reply to this email directly, view it on GitHub https://github.com/AstronomyAPI/Samples/issues/75#issuecomment-2293276892, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRZPFWZYH2L3OVZLXMU3TZRXJ3VAVCNFSM6AAAAABMQWK2BKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGI3TMOBZGI . You are receiving this because you authored the thread.Message ID: @.***>

-- בכבוד רב, ברק שקד המסלול הירוק לקידום ברשת www.hamaslul-hayarok.co.il

astroanu commented 3 weeks ago

Could you post the appId you're using to call the API ?

barakforkids commented 3 weeks ago

f76bf9d8-8c24-420f-8802-97bd88506fc3

this is how I add the header client.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(ApplicationId + ":" + ApplicationSecret))); *I tried to replace this with hard coded the string after the convert, got the same error

‫בתאריך יום ו׳, 16 באוג׳ 2024 ב-18:04 מאת ‪astroanu‬‏ <‪ @.***‬‏>:‬

Could you post the appId you're using to call the API ?

— Reply to this email directly, view it on GitHub https://github.com/AstronomyAPI/Samples/issues/75#issuecomment-2293678332, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRZPDWI23PZXCELEOSRBLZRYIHJAVCNFSM6AAAAABMQWK2BKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTGY3TQMZTGI . You are receiving this because you authored the thread.Message ID: @.***>

-- בכבוד רב, ברק שקד המסלול הירוק לקידום ברשת www.hamaslul-hayarok.co.il

astroanu commented 3 weeks ago

I could not find any requests made using this application ID using .net. I have enabled c# snippet generation in http://demo.astronomyapi.com/. Could you try the example code with your application id and secret. ?

barakforkids commented 3 weeks ago

when I use the demo it is working fine only from my webpage it doesn work and get 403 [image: image.png]

‫בתאריך יום ו׳, 16 באוג׳ 2024 ב-20:04 מאת ‪astroanu‬‏ <‪ @.***‬‏>:‬

I could not find any requests made using this application ID using .net. I have enabled c# snippet generation in http://demo.astronomyapi.com/. Could you try the example code with your application id and secret. ?

— Reply to this email directly, view it on GitHub https://github.com/AstronomyAPI/Samples/issues/75#issuecomment-2293854844, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRZPCP4CTJXS5IIMMP5QLZRYWJTAVCNFSM6AAAAABMQWK2BKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEOJTHA2TIOBUGQ . You are receiving this because you authored the thread.Message ID: @.***>

-- בכבוד רב, ברק שקד המסלול הירוק לקידום ברשת www.hamaslul-hayarok.co.il

barakforkids commented 3 weeks ago

צילום מסך 2024-08-16 200517

barakforkids commented 2 weeks ago

Hi. I've managed to get response from the api now, now when i'm tring to get the moonrise/moonset hour i'm getting error 422 this is the api url i'm using, can you please show how to fix it? https://api.astronomyapi.com/api/v2/bodies/positions/moon?latitude=31.7683&longitude=35.2137&from_date=2024-08-01&to_date=2024-08-31 thank you.

astroanu commented 2 weeks ago

It doesn't have the elevation and time. Check this page for all the "observer request params" https://docs.astronomyapi.com/requests-and-response/observer-parameters

barakforkids commented 2 weeks ago

Ah, I see.

‫בתאריך יום ד׳, 28 באוג׳ 2024 ב-16:33 מאת ‪astroanu‬‏ <‪ @.***‬‏>:‬

It doesn't have the elevation and time. Check this page for all the "observer request params" https://docs.astronomyapi.com/requests-and-response/observer-parameters

— Reply to this email directly, view it on GitHub https://github.com/AstronomyAPI/Samples/issues/75#issuecomment-2315332758, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABHRZPDZTIWDLTF5XEQRJEDZTXGSHAVCNFSM6AAAAABMQWK2BKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMJVGMZTENZVHA . You are receiving this because you authored the thread.Message ID: @.***>