Another API question: I think after the API update, my graphql queries aren’t working anymore. I’m sure this is just a syntax issue, but I can’t even run the example queries on the documentation site. Can anyone spot what’s wrong with my query?
I’ve also attached what the example query on the documentation site looks like. Maybe this instance hasn’t been updated to the latest version of the API?
def sf_ca_gql_request(params):
query = """
query($city: String, $start_date: DateTime!, $end_date: DateTime!) {
search(filter: {
address: {
city: $city
iso_country_code: "CA"
}
}){
safegraph_weekly_patterns(start_date: $start_date end_date: $end_date) {
places(first: 300000 after: "") {
edges {
node {
safegraph_patterns {
city
raw_visit_counts
poi_cbg
}
}
}
}
}
}
}
"""
req = requests.post(
'https://api.safegraph.com/v2/graphql',
json={
'query': query,
'variables': params
},
headers=headers
)
return req.json()
params = {
'start_date': '2020-01-07',
'end_date': '2020-02-04',
'city': 'Toronto',
}
ca_toronto_test = sf_gql_request(params)
ca_toronto_test
