Skip to main content
APIs 3 min read

HERE Platform Services VS When to Build URLs Manually

article banner

HERE platform Services VS When to Build URLs Manually

In recent blog posts, I explored how to construct URLs to interact with HERE API services, including fetching weather data with the HERE Weather API and integrating a custom HERE basemap in ArcGIS Online.

While reviewing JavaScript code samples on GitHub, I noticed different approaches to calling HERE APIs. For example, when using the HERE Geocoding and Search API, developers can either use built-in platform methods, such as getSearchService(), or manually construct API request URLs.

A similar choice exists when working with the HERE Traffic API

Consider these two examples, both retrieving traffic incident data in Berlin within a 15km radius.

Using HERE platform Services

This approach leverages the getTrafficService() method provided by the HERE JavaScript SDK

Copied
         let trafficService = platform.getTrafficService();
      platform.getTrafficService(null, 7).requestIncidentsByArea(
        {
          in: "circle:52.5189,13.4158;r=15000",
          locationReferencing: "shape",
        },
        console.log,
        console.error
      );

  
  • Simplifies API Calls – No need to manually construct URLs; platform methods handle request formatting for you.
  • Handles Authentication & Errors – The SDK includes built-in authentication, error handling, and retry logic.
  • Better Maintainability – If the API changes, updates are applied at the service level instead of across multiple manual API calls.
  • Consistency Across Your Application – Ensures all API requests follow the same structure, reducing discrepancies.
  • Official Documentation & Support – HERE’s platform services come with comprehensive documentation, making it easier to troubleshoot issues.

 Example: Learn more about the HERE Traffic Service method.

 

Manually Constructing the API URL

Alternatively, you can make a direct API request using fetch()

Copied
        async function fetchTrafficData() {
        const apiKey = "YOUR API KEY"
        const url = `https://data.traffic.hereapi.com/v7/flow?
        locationReferencing=shape&in=circle:52.5189,13.4158;r=15000&apiKey=${apiKey}`;

        try {
          const response = await fetch(url);
          const data = await response.json();
          console.log("fetchTrafficData", data);
          return data;
        } catch (error) {
          console.error("Error fetching traffic data:", error);
        }
      }
      fetchTrafficData();

  
  • More Control – Allows fine-tuning request parameters without SDK limitations.
  • Works Outside JavaScript Environments – Ideal for backend scripts (e.g., Python) or non-JavaScript applications.
  • Lighter Dependencies – No need to load the full HERE SDK if you're only making a few API calls.
  • Custom Requirements – If platform services don’t cover a specific use case, manual requests provide flexibility.
  • Performance Optimization – Optimize API calls by including only necessary parameters, reducing payload size.
  • Integration with Legacy Systems – Essential when working with older systems that don’t support modern SDKs.
  • Learning & Debugging – A great way to understand API mechanics and troubleshoot issues.

 

Conclusion

Both methods have their strengths, and the best choice depends on your project’s needs. If you're building a HERE-powered web app, platform Services offer ease of use and consistency. But if you need more control, flexibility, or lightweight API calls, manual URL construction is a great alternative.

Happy coding!

AJ

Alberts Jekabsons

Sr. Developer Evangelist

Have your say

Sign up for our newsletter

Why sign up:

  • Latest offers and discounts
  • Tailored content delivered weekly
  • Exclusive events
  • One click to unsubscribe