-
Notifications
You must be signed in to change notification settings - Fork 345
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
Create script to fetch company data from stackshare api #1572
base: master
Are you sure you want to change the base?
Conversation
in | ||
let uri = Uri.of_string uri in | ||
let body = | ||
`O [("query", `String query)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is this piece of code doing?
and Why are we using Ezjsonm.to_string
body if the above expression is already converting the query to string form.??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this the json object is being constructed, so body
is still an ezyjsonm type which is why you still need to convert body to a string type for sending the post request in line 38.
Also, if you do an opam install ocamlformat
and run dune build @fmt --auto-promote .
it will format the code so it's more legible. :)
Hii @patricoferris, can you please help me resolve this. |
As @gs0510 quite rightly mentioned I suggest having a play around with it in utop # Ezjsonm.to_string (`O ["hello", `String "world"]);;
- : string = "{\"hello\":\"world\"}" Most GraphQL APIs (afaik) understand the body as a JSON object where they query is stored as a value associated with a key called {
"query": "query { ... }"
} Also as a general rule it is pretty bad to commit API keys into any code. Other people could abuse it but the blame may come back to you since it is your API key. I don't think anyone here would do that of course, but just letting you know :)) You probably want to disable that API key and generate a new one. |
Thanks, @gs0510, @patricoferris, I understood the use of I think the error is caused due to the presence of arguments inside the query but I don't know how to resolve that. Plse kindly look into this and help me. |
Issue Description
In addition to the locally maintained lists, stackshare has a list of companies using OCaml
https://stackshare.io/ocaml
The issue is to generate a JSON file from the stackshare API.
Please include a summary of the issue.
Work in progress #1503
Changes Made
I tried to fetch data from the API but it is showing this error:
Please describe the changes that you made.