{"action":"created","issue":{"url":"https://api.github.com/repos/WP-API/WP-API/issues/926","labels_url":"https://api.github.com/repos/WP-API/WP-API/issues/926/labels{/name}","comments_url":"https://api.github.com/repos/WP-API/WP-API/issues/926/comments","events_url":"https://api.github.com/repos/WP-API/WP-API/issues/926/events","html_url":"https://github.com/WP-API/WP-API/issues/926","id":58846174,"number":926,"title":"Easy flag to use to detect when a request is a WP-API request","user":{"login":"danielbachhuber","id":36432,"avatar_url":"https://avatars.githubusercontent.com/u/36432?v=3","gravatar_id":"","url":"https://api.github.com/users/danielbachhuber","html_url":"https://github.com/danielbachhuber","followers_url":"https://api.github.com/users/danielbachhuber/followers","following_url":"https://api.github.com/users/danielbachhuber/following{/other_user}","gists_url":"https://api.github.com/users/danielbachhuber/gists{/gist_id}","starred_url":"https://api.github.com/users/danielbachhuber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielbachhuber/subscriptions","organizations_url":"https://api.github.com/users/danielbachhuber/orgs","repos_url":"https://api.github.com/users/danielbachhuber/repos","events_url":"https://api.github.com/users/danielbachhuber/events{/privacy}","received_events_url":"https://api.github.com/users/danielbachhuber/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/WP-API/WP-API/labels/Enhancement","name":"Enhancement","color":"009800"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/WP-API/WP-API/milestones/5","html_url":"https://github.com/WP-API/WP-API/milestones/Core%20Integration","labels_url":"https://api.github.com/repos/WP-API/WP-API/milestones/5/labels","id":502054,"number":5,"title":"Core Integration","description":"Things that need to be handled in the actual core integration step, not before.","creator":{"login":"rmccue","id":21655,"avatar_url":"https://avatars.githubusercontent.com/u/21655?v=3","gravatar_id":"","url":"https://api.github.com/users/rmccue","html_url":"https://github.com/rmccue","followers_url":"https://api.github.com/users/rmccue/followers","following_url":"https://api.github.com/users/rmccue/following{/other_user}","gists_url":"https://api.github.com/users/rmccue/gists{/gist_id}","starred_url":"https://api.github.com/users/rmccue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmccue/subscriptions","organizations_url":"https://api.github.com/users/rmccue/orgs","repos_url":"https://api.github.com/users/rmccue/repos","events_url":"https://api.github.com/users/rmccue/events{/privacy}","received_events_url":"https://api.github.com/users/rmccue/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":13,"state":"open","created_at":"2013-12-02T07:21:56Z","updated_at":"2015-05-28T05:51:58Z","due_on":null,"closed_at":null},"comments":11,"created_at":"2015-02-25T03:47:44Z","updated_at":"2015-05-28T05:51:58Z","closed_at":"2015-05-28T05:51:58Z","body":"For WordPress developers using actions and filters to integrate with WP-API, it would be helpful to have an easy to use flag to detect when a given request is a WP-API request.\r\n\r\n`DOING_AJAX` is the first equivalent that comes to mind. I don't think a constant is a horrible idea, but I'm open to other suggestions."},"comment":{"url":"https://api.github.com/repos/WP-API/WP-API/issues/comments/106187299","html_url":"https://github.com/WP-API/WP-API/issues/926#issuecomment-106187299","issue_url":"https://api.github.com/repos/WP-API/WP-API/issues/926","id":106187299,"user":{"login":"rmccue","id":21655,"avatar_url":"https://avatars.githubusercontent.com/u/21655?v=3","gravatar_id":"","url":"https://api.github.com/users/rmccue","html_url":"https://github.com/rmccue","followers_url":"https://api.github.com/users/rmccue/followers","following_url":"https://api.github.com/users/rmccue/following{/other_user}","gists_url":"https://api.github.com/users/rmccue/gists{/gist_id}","starred_url":"https://api.github.com/users/rmccue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmccue/subscriptions","organizations_url":"https://api.github.com/users/rmccue/orgs","repos_url":"https://api.github.com/users/rmccue/repos","events_url":"https://api.github.com/users/rmccue/events{/privacy}","received_events_url":"https://api.github.com/users/rmccue/received_events","type":"User","site_admin":false},"created_at":"2015-05-28T05:51:58Z","updated_at":"2015-05-28T05:51:58Z","body":"This is not going to happen any time in the near future.\r\n\r\nThere is intentionally no constant or function for this, as the REST API parts are intended to be usable internally as well. Checking for whether something is a REST API request is `_doing_it_wrong`, as it should be done at the API layer itself, rather than deeper down.\r\n\r\nWhile it's true that mobile requests want efficient requests, that's something that needs to be handled at the API layer, *not* deeper in the codebase. Doing it deeper ties the layers together and makes it much harder to use the API internally for data processing and pre-generation of data for front-end apps. If you think you need to do this, *please* rethink what you're trying to do."}}