swop-cx / swop

GraphQL and REST foreign exchange rate API
https://swop.cx/
1 stars 0 forks source link

lexical error: invalid char in json text #1

Closed margulesgroome closed 2 years ago

margulesgroome commented 2 years ago

Hi, as of about 18 Sept we receive this following error message when retrieving data via the swop.cx API:

Error: lexical error: invalid char in json text.

504 Gatewa (right here) ------^ Code has been running for ~2 years without issues so unsure if something changed on the API side ? Any help will be appreciated. Thank you </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jadlr"><img src="https://avatars.githubusercontent.com/u/696999?v=4" />jadlr</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Hi @margulesgroome can you give us details about what endpoint you're calling?</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/margulesgroome"><img src="https://avatars.githubusercontent.com/u/115610740?v=4" />margulesgroome</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Hi</p> <p>Can you please clarify what you mean with endpoint ?</p> <p>Thank you Rudolf</p> <p>Margules Groome Consulting Pty Ltd Scottish House Level 4, 90 William St Melbourne, VIC, 3000, AUSTRALIA Tel: +61 3 8199 7937 Mobile: +61 (0) 400 144 742 Skype: rudolf_van_rensburg</p> <p><strong><em>@</em></strong>.***<a href="http://www.margulesgroome.com/">http://www.margulesgroome.com/</a></p> <p>From: Jonas Adler <strong><em>@</em></strong>.<strong><em>> Sent: Wednesday, 12 October 2022 5:20 PM To: swop-cx/swop </em></strong>@<strong><em>.</em></strong>> Cc: Rudolf van Rensburg <strong><em>@</em></strong>.<strong><em>>; Mention </em></strong>@<strong><em>.</em></strong>> Subject: Re: [swop-cx/swop] lexical error: invalid char in json text (Issue #1)</p> <p>Hi @margulesgroome<a href="https://github.com/margulesgroome">https://github.com/margulesgroome</a> can you give us details about what endpoint you're calling?</p> <p>— Reply to this email directly, view it on GitHub<a href="https://github.com/swop-cx/swop/issues/1#issuecomment-1275649271">https://github.com/swop-cx/swop/issues/1#issuecomment-1275649271</a>, or unsubscribe<a href="https://github.com/notifications/unsubscribe-auth/A3SBI5BTRLVM6IW3RB7HY6LWCZKAFANCNFSM6AAAAAARC5TFCY">https://github.com/notifications/unsubscribe-auth/A3SBI5BTRLVM6IW3RB7HY6LWCZKAFANCNFSM6AAAAAARC5TFCY</a>. You are receiving this because you were mentioned.Message ID: <strong><em>@</em></strong>.<strong>**</strong>@<strong><em>.</em></strong>>></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jadlr"><img src="https://avatars.githubusercontent.com/u/696999?v=4" />jadlr</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Hi Rudolf, are you using the REST or the GraphQL API? Can you give me details about the request/query you're executing? Thanks!</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/margulesgroome"><img src="https://avatars.githubusercontent.com/u/115610740?v=4" />margulesgroome</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Hi,</p> <p>We are using an R environment to call the swop API. Below the code we are using. As indicated this code has been running well for ~2 years but stopped working on 18 Sept.</p> <p>CurrencyList <- c('AUD','BRL','CLP','CNY','EUR','GBP','JPY','MYR','NZD','UYU','VND','ZAR') # List of quote currencies</p> <p>ResultDF<- data.frame() # empty dataframe as output holder</p> <h1>Now adjusted to make the date range dynamic for each currency</h1> <p>for(i in 1:length(CurrencyList)) # loop 1 {</p> <pre><code>LastAvailableFXDate <- sqlQuery(ch,paste("SELECT MAX(quote_date) AS LastAvailableFXDate FROM forex.daily_fx WHERE forecast = 0 and quote_currency = '", CurrencyList[i], "'", sep='')) StartFXQueryDate <- as.Date(LastAvailableFXDate[1,1],format="%Y-%m-%d")+1 DateList <- seq(StartFXQueryDate, MaxQueryDate, by = "days") # List of dates for(h in 1:length(DateList)) # loop 2 { APIQuery <- paste(https://swop.cx/rest/rates?date=,DateList[h],"&base_currency=USD&quote_currencies=", CurrencyList[i], sep='') #print(APIQuery) result <- GET(APIQuery,add_headers(Authorization = paste("ApiKey", apiKey))) jsonResponseText <- content(result,"text", encoding = "ISO-8859-1") Data = fromJSON(jsonResponseText) ResultDF<-bind_rows(ResultDF, Data)</code></pre> <p>Regard Rudolf</p> <p>From: Jonas Adler <strong><em>@</em></strong>.<strong><em>> Sent: Wednesday, 12 October 2022 6:15 PM To: swop-cx/swop </em></strong>@<strong><em>.</em></strong>> Cc: Rudolf van Rensburg <strong><em>@</em></strong>.<strong><em>>; Mention </em></strong>@<strong><em>.</em></strong>> Subject: Re: [swop-cx/swop] lexical error: invalid char in json text (Issue #1)</p> <p>Hi Rudolf, are you using the REST or the GraphQL API? Can you give me details about the request/query you're executing? Thanks!</p> <p>— Reply to this email directly, view it on GitHub<a href="https://github.com/swop-cx/swop/issues/1#issuecomment-1275698520">https://github.com/swop-cx/swop/issues/1#issuecomment-1275698520</a>, or unsubscribe<a href="https://github.com/notifications/unsubscribe-auth/A3SBI5HJRHLX4C55RDYFAVLWCZQPDANCNFSM6AAAAAARC5TFCY">https://github.com/notifications/unsubscribe-auth/A3SBI5HJRHLX4C55RDYFAVLWCZQPDANCNFSM6AAAAAARC5TFCY</a>. You are receiving this because you were mentioned.Message ID: <strong><em>@</em></strong>.<strong>**</strong>@<strong><em>.</em></strong>>></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jadlr"><img src="https://avatars.githubusercontent.com/u/696999?v=4" />jadlr</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>I just tried the request and it works fine. I also checked our logs and couldn't find our service responding with a 504. Could it be that something in you network changed. 504 indicates a gateway timeout. This could come from a firewall or proxy. </p> <p>We didn't deploy any changes around the 18th of Sept.</p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/margulesgroome"><img src="https://avatars.githubusercontent.com/u/115610740?v=4" />margulesgroome</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>Jonas</p> <p>Thank you – we think we just found the issue, a change of directory structure on our server that was caused by 3rd party software.</p> <p>Thank you for your prompt responses and willingness to assist.</p> <p>Best regards Rudolf</p> <p>From: Jonas Adler <strong><em>@</em></strong>.<strong><em>> Sent: Wednesday, 12 October 2022 6:32 PM To: swop-cx/swop </em></strong>@<strong><em>.</em></strong>> Cc: Rudolf van Rensburg <strong><em>@</em></strong>.<strong><em>>; Mention </em></strong>@<strong><em>.</em></strong>> Subject: Re: [swop-cx/swop] lexical error: invalid char in json text (Issue #1)</p> <p>I just tried the request and it works fine. I also checked our logs and couldn't find our service responding with a 504. Could it be that something in you network changed. 504 indicates a gateway timeout. This could come from a firewall or proxy.</p> <p>We didn't deploy any changes around the 18th of Sept.</p> <p>— Reply to this email directly, view it on GitHub<a href="https://github.com/swop-cx/swop/issues/1#issuecomment-1275716638">https://github.com/swop-cx/swop/issues/1#issuecomment-1275716638</a>, or unsubscribe<a href="https://github.com/notifications/unsubscribe-auth/A3SBI5DUHZFTSVNTW6AV2DDWCZSOPANCNFSM6AAAAAARC5TFCY">https://github.com/notifications/unsubscribe-auth/A3SBI5DUHZFTSVNTW6AV2DDWCZSOPANCNFSM6AAAAAARC5TFCY</a>. You are receiving this because you were mentioned.Message ID: <strong><em>@</em></strong>.<strong>**</strong>@<strong><em>.</em></strong>>></p> </div> </div> <div class="comment"> <div class="user"> <a rel="noreferrer nofollow" target="_blank" href="https://github.com/jadlr"><img src="https://avatars.githubusercontent.com/u/696999?v=4" />jadlr</a> commented <strong> 2 years ago</strong> </div> <div class="markdown-body"> <p>You're very welcome, Rudolf! I'll close this issue for now, let me know if you run into any other issues. </p> </div> </div> <div class="page-bar-simple"> </div> <div class="footer"> <ul class="body"> <li>© <script> document.write(new Date().getFullYear()) </script> Githubissues.</li> <li>Githubissues is a development platform for aggregating issues.</li> </ul> </div> <script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script> <script src="/githubissues/assets/js.js"></script> <script src="/githubissues/assets/markdown.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/highlight.min.js"></script> <script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.4.0/build/languages/go.min.js"></script> <script> hljs.highlightAll(); </script> </body> </html>