Coworking Map API Getting start:


Authentication:

Coworkingmap.org ’s API uses JSON Web Token (JWT) for authentication. If you want to learn more about this, visit jwt.io. All requests will be authenticated by a token which expires within one week. To create one, use your preferred language and send a POST to the route down below, sending your username and password as parameters. To obtain the data, create an account through this link.

 

POST:  https://coworkingmap.org/wp-json/jwt-auth/v1/token/?username=YOUR_USERNAME&password=YOUR_PASSWORD

 

As a result, a JSON will return in the following format:

{
"token": "1234567890.0987654321.1234567890",
"user_email": "[email protected]",
"user_nicename": "your username",
"user_display_name": "Your Name",
"request": 99 //Quantidade de requests realizadas no mês
}

 

With your token in hands, all you have to do is add a Header to all of your requests in the following format:

Authorization: Bearer 1234567890.0987654321.1234567890 //Token gerado

 

To check the expiration date of your token, the following route is available:

POST:  https://coworkingmap.org/wp-json/jwt-auth/v1/token/validate/

 

Listing spaces:

To consult coworking spaces, there are three routes with the options of filtering by country, city and space name. They all respond to the verb GET, and below you can see some examples of uses and the responses:

Filtering by country

GET:  https://coworkingmap.org/wp-json/spaces/united-kingdom

 

[  
   {  
      "city":"London",
      "map":{  
         "address":"43c Old London Road, Kingston upon Thames, United Kingdom",
         "lat":"51.41088689999999",
         "lng":"-0.29889170000001286"
      },
      "name":"Kingston CoWork",
      "slug":"kingston-cowork"
   },
   {  
      "city":"London",
      "map":{  
         "address":"98 Victoria Road, London NW10 6NB, United Kingdom",
         "lat":"51.5255905",
         "lng":"-0.2549043999999867"
      },
      "name":"Cowork Hub",
      "slug":"cowork-hub"
   },
   {  
      "city":"Guildford",
      "map":{  
         "address":"20 Nugent Road, Surrey Research Park, Guildford, Surrey, GU2 7AF",
         "lat":"51.24096669999999",
         "lng":"-0.6153684999999314"
      },
      "name":"Rocketdesk",
      "slug":"rocketdesk"
   }
]

 

Filtering by city:

GET:  https://coworkingmap.org/wp-json/spaces/united-kingdom/london

 

[  
   {  
      "map":{  
         "address":"43c Old London Road, Kingston upon Thames, United Kingdom",
         "lat":"51.41088689999999",
         "lng":"-0.29889170000001286"
      },
      "name":"Kingston CoWork",
      "slug":"kingston-cowork"
   },
   {  
      "map":{  
         "address":"98 Victoria Road, London NW10 6NB, United Kingdom",
         "lat":"51.5255905",
         "lng":"-0.2549043999999867"
      },
      "name":"Cowork Hub",
      "slug":"cowork-hub"
   },
   {  
      "map":{  
         "address":"London W6 9DL, United Kingdom",
         "lat":"51.4922319",
         "lng":"-0.22455909999996493"
      },
      "name":"Accelerate West",
      "slug":"accelerate-west"
   }
]

Filtering by space:

GET:  https://coworkingmap.org/wp-json/spaces/united-kingdom/london/space-name

 

{  
   "country":"United Kingdom",
   "city":"London",
   "map":{  
      "address":"98 Victoria Road, London NW10 6NB, United Kingdom",
      "lat":"51.5255905",
      "lng":"-0.2549043999999867"
   },
   "description":"Space description",
   "email":"[email protected]",
   "website":"www.spacesite.com",
   "logo":"space-logo.jpg",
   "cover-photo":"space-cover.jpg",
   "name":"Space Name",
   "slug":"space-slug"
}