API Consumption: Best Practices


To help developers get the very best out of the AdultWork.com API, we have written this small blog that briefly details some of the good practices that should be followed when it comes to consuming the API.

One of the most common implementations that the API lends itself to is a Profile Listings directory-type application or website. The two main API endpoints that developers would use are /search/searchProfiles and /profile/getProfileDetails.

If a developer chooses to import and cache API data on their own servers we would highly recommend that the getProfileDetails endpoint is only requested on demand - when the end-user chooses to view more information for a specific profile. The response data from the API should be cached with a TTL (Time To Live) and any subsequent end-user requests for that specific profile should then be served from the developer's local cache until the TTL expires and a new getProfileDetails API request is required.

Caching data from the searchProfiles endpoint should be implemented with the ProfilesPerPage request property set to its maximum of 100, and with other criteria such as IsEscort set to true. The more criteria a developer specifies, the faster the API will respond.

Developers should be aware that caching data from the AdultWork API for long periods of time will likely result in the data being out of date or irrelevant. Profiles are added, removed and modified on the AdultWork.com Platform 24 hours a day, 7 days a week, so this is something to bear in mind when deciding the duration of a cache's TTL.