{"action":"created","issue":{"url":"https://api.github.com/repos/brainwipe/NJsonApiCore/issues/29","repository_url":"https://api.github.com/repos/brainwipe/NJsonApiCore","labels_url":"https://api.github.com/repos/brainwipe/NJsonApiCore/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/brainwipe/NJsonApiCore/issues/29/comments","events_url":"https://api.github.com/repos/brainwipe/NJsonApiCore/issues/29/events","html_url":"https://github.com/brainwipe/NJsonApiCore/issues/29","id":196037602,"number":29,"title":"Ability to disable link building","user":{"login":"Sprot","id":23076496,"avatar_url":"https://avatars.githubusercontent.com/u/23076496?v=3","gravatar_id":"","url":"https://api.github.com/users/Sprot","html_url":"https://github.com/Sprot","followers_url":"https://api.github.com/users/Sprot/followers","following_url":"https://api.github.com/users/Sprot/following{/other_user}","gists_url":"https://api.github.com/users/Sprot/gists{/gist_id}","starred_url":"https://api.github.com/users/Sprot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Sprot/subscriptions","organizations_url":"https://api.github.com/users/Sprot/orgs","repos_url":"https://api.github.com/users/Sprot/repos","events_url":"https://api.github.com/users/Sprot/events{/privacy}","received_events_url":"https://api.github.com/users/Sprot/received_events","type":"User","site_admin":false},"labels":[{"id":377032132,"url":"https://api.github.com/repos/brainwipe/NJsonApiCore/labels/question","name":"question","color":"cc317c","default":true}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-12-16T11:21:43Z","updated_at":"2016-12-16T12:36:30Z","closed_at":null,"body":"Is there a possibility to disable link building?\r\n\r\nI have some specific action models that are not related to any specific id. But as Id field is a must in jsonapi I generate new Guid for ID. But I would like to disable link building for such objects as those links are wrong and do not represent this object correctly.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/brainwipe/NJsonApiCore/issues/comments/267585485","html_url":"https://github.com/brainwipe/NJsonApiCore/issues/29#issuecomment-267585485","issue_url":"https://api.github.com/repos/brainwipe/NJsonApiCore/issues/29","id":267585485,"user":{"login":"brainwipe","id":1922279,"avatar_url":"https://avatars.githubusercontent.com/u/1922279?v=3","gravatar_id":"","url":"https://api.github.com/users/brainwipe","html_url":"https://github.com/brainwipe","followers_url":"https://api.github.com/users/brainwipe/followers","following_url":"https://api.github.com/users/brainwipe/following{/other_user}","gists_url":"https://api.github.com/users/brainwipe/gists{/gist_id}","starred_url":"https://api.github.com/users/brainwipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/brainwipe/subscriptions","organizations_url":"https://api.github.com/users/brainwipe/orgs","repos_url":"https://api.github.com/users/brainwipe/repos","events_url":"https://api.github.com/users/brainwipe/events{/privacy}","received_events_url":"https://api.github.com/users/brainwipe/received_events","type":"User","site_admin":false},"created_at":"2016-12-16T12:36:30Z","updated_at":"2016-12-16T12:36:30Z","body":"I am beginning to understand, thank you!\r\n\r\nNow there is a core idea to API design (not just json:api) that a _resource_ does not have to be the same thing as a _domain entity_. A resource is often a combination of domain entities or something that doesn't even exist. Choosing resources properly is important and in json:api there are only resources. A resource must be uniquely identifiable as per REST/http.\r\n\r\nIt appears that you want to ask the API \"tell me the number of active objects for these users for this period\". I'm also going to assume that User is a Resource too. Am I right? I'll assume so and keep going...\r\n\r\nIt seems to me that your resource is actually **Period** and that you're returning multiple periods. So I would reorganise the API to be the following:\r\n\r\nFirst, let's get all the periods with all the users:\r\n```\r\nGET http://localhost:50873/Controller/Periods\r\n{\r\n    \"data\": [\r\n        {\r\n            \"id\": \"1\",\r\n            \"type\": \"periods\",\r\n            \"attributes\": {\r\n                \"numberOfObjects\": 3284123213\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://localhost:50873/Controller/Periods/1\"\r\n            },\r\n        },\r\n        {\r\n            \"id\": \"2\",\r\n            \"type\": \"periods\",\r\n            \"attributes\": {\r\n                \"numberOfObjects\": 2123213\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://localhost:50873/Controller/Periods/2\"\r\n            }\r\n        },\r\n       /** More periods go in here **/\r\n    ],\r\n    \"links\": {\r\n        \"self\": \"http://localhost:50873/Controller/Periods\"\r\n    },\r\n    \"jsonapi\": {\r\n        \"version\": \"1.0\"\r\n    }\r\n}\r\n\r\nNow your example doesn't want all periods and all users, so we must use the `filter` attribute (that you implement yourself). I'm going to use the [json:api filtering](http://jsonapi.org/recommendations/#filtering) as an example:\r\n\r\n```\r\nGET http://localhost:50873/Controller/Periods?filter[periods]=1,2&filter[users]=1,2,3,4\r\n\r\nGET http://localhost:50873/Controller/Periods\r\n{\r\n    \"data\": [\r\n        {\r\n            \"id\": \"1\",\r\n            \"type\": \"periods\",\r\n            \"attributes\": {\r\n                \"numberOfObjects\": 3284\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://localhost:50873/Controller/Periods/1\"\r\n            },\r\n        },\r\n        {\r\n            \"id\": \"2\",\r\n            \"type\": \"periods\",\r\n            \"attributes\": {\r\n                \"numberOfObjects\": 2\r\n            },\r\n            \"links\": {\r\n                \"self\": \"http://localhost:50873/Controller/Periods/2\"\r\n            }\r\n        }\r\n    ],\r\n    \"links\": {\r\n        \"self\": \"http://localhost:50873/Controller/Periods?filter[periods]=1,2&filter[users]=1,2,3,4\"\r\n    },\r\n    \"jsonapi\": {\r\n    \"version\": \"1.0\"\r\n   }\r\n}\r\n\r\n```\r\n\r\nNote - the characters `[]` aren't allowed, they'll actually need to be URL encoded.\r\n\r\nNow if you want to make this truly discoverable, I'd include Relationships to the Users within each Period. That will make your API payload a bit fatter and is only needed if you want the client to be able to move around your API."}}
{"actor":{"display_login":"brainwipe"}}