The Database Hub | Back4App
The Database Hub | Back4App
How it works
  • Log In
  • Sign Up

  1. Back4App
  2. World Continents, Countries, and Cities
Public

1210
5629
1210
5629
  • DatabaseDatabase
  • GraphQL API PlaygroundAPI Playground
  • Get Started GuideGet Started
  • IssuesIssues
  • ContributorsContributors
  • Database
    Database
    GraphQL API Playground
    API Playground
    Get Started Guide
    Get Started
    Contributors
    Contributors

  1. IssueOpen
  2. How to fetch all cities with the country names

New IssueNew

kunntech commented this issue on Nov 2021

I want to fetch all cities with the country names?

adavimacedo commented this issue on Nov 2021

Something like this should do what you need:

(async () => {
        const response = await fetch(
          'https://parseapi.back4app.com/classes/City?limit=10&include=country&keys=name,country,country.name,population,location,cityId,adminCode',
          {
            headers: {
              'X-Parse-Application-Id': 'mxsebv4KoWIGkRntXwyzg6c6DhKWQuit8Ry9sHja', // This is the fake app's application id
              'X-Parse-Master-Key': 'TpO0j3lG2PmEVMXlKYQACoOXKQrL3lwM0HwR9dbH', // This is the fake app's readonly master key
            }
          }
        );
        const data = await response.json(); // Here you have the data that you need
        console.log(JSON.stringify(data, null, 2));
      })();
Please enter a comment for this issue.