I'm trying to do a post request for creating a server inthe openstack using REST API. i tried this code (followed in the Openstack documentation) but it won't work.
Can you help please?
{
"server": { "name":"auto-allocate-network",
"imageRef":"d84ddc27-7e79-4f5f-a4fb-f5fccda375c3",
"flavorRef":"583c710b-684b-4d05-a65c-eb69927212bd",
"availability_zone": "nova",
"network":"9f2989d3-c859-4ff5-ae0b-163e4562ea38"
}}
the URI is :
http://192.1.1.184:8774/v2.1/servers
try this code, it works for me:
{
"server": {
"name": "test-vm1",
"imageRef": "876d6dd5-06c7-43ea-8917-3f93ca074885",
"flavorRef": "1",
"max_count": 1,
"min_count": 1,
"networks": [
{
"uuid": "3b7f6755-46b1-4437-a164-5757bf0baedc"
}
],
"security_groups": [
{
"name": "default"
}
]
}
}
this solution from #node not work for me,
and this is my result :
{
"choices": [
{
"status": "SUPPORTED",
"media-types": [
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2"
}
],
"id": "v2.0",
"links": [
{
"href": "http://rocky-controller.jcamp.net:8774/v2/v2.0/c0b89f614b5a457cb5acef8fe8c2b320/servers",
"rel": "self"
}
]
},
{
"status": "CURRENT",
"media-types": [
{
"base": "application/json",
"type": "application/vnd.openstack.compute+json;version=2.1"
}
],
"id": "v2.1",
"links": [
{
"href": "http://rocky-controller.jcamp.net:8774/v2.1/v2.0/c0b89f614b5a457cb5acef8fe8c2b320/servers",
"rel": "self"
}
]
}
]
}
Related
I am trying to trigger CUSTOMER.DISPUTE.RESOLVED event for disputes testing in sandbox, for that i made a test payment and opened a dispute in the resolution center. To trigger dispute resolved event i wanna call settle dispute method https://developer.paypal.com/docs/api/customer-disputes/v1#disputes-actions_adjudicate.
However i am not able to do that, cuz after create dispute is in WAITING_FOR_SELLER_RESPONSE status and i allowed only to call accept claim and provide evidence.
After accept claim i am able only to call provide supporting info method, settle method is still not allowed.
So my question is how to trigger CUSTOMER.DISPUTE.RESOLVED event in sandbox and on what dispute state i need to call settle method from here https://developer.paypal.com/docs/api/customer-disputes/v1#disputes-actions_adjudicate?
Request/Response examples
Dispute details right after open
{
"dispute_id": "PP-D-40523",
"create_time": "2021-03-03T08:47:08.000Z",
"update_time": "2021-03-03T08:48:12.000Z",
"disputed_transactions": [
{
"buyer_transaction_id": "35703532VD052404F",
"seller_transaction_id": "92198049S8582070N",
"create_time": "2021-03-03T08:41:55.000Z",
"transaction_status": "COMPLETED",
"gross_amount": {
"currency_code": "USD",
"value": "29.99"
},
"buyer": {
"name": "John Doe"
},
"seller": {
"email": "sb-47flty3787626#business.example.com",
"merchant_id": "TQNC9P6W9822C",
"name": "John Doe's Test Store"
},
"items": [],
"seller_protection_eligible": true
}
],
"reason": "UNAUTHORISED",
"status": "WAITING_FOR_SELLER_RESPONSE",
"dispute_amount": {
"currency_code": "USD",
"value": "29.99"
},
"dispute_life_cycle_stage": "CHARGEBACK",
"dispute_channel": "INTERNAL",
"extensions": {
"buyer_contacted_time": "2021-02-11T17:50:48.000Z"
},
"seller_response_due_date": "2021-03-24T08:47:50.000Z",
"allowed_response_options": {
"accept_claim": {
"accept_claim_types": [
"REFUND"
]
}
},
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40523",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40523/provide-evidence",
"rel": "provide_evidence",
"method": "POST"
},
{
"href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40523/accept-claim",
"rel": "accept_claim",
"method": "POST"
}
]
}
After provide evidence
{
"dispute_id": "PP-D-40523",
"create_time": "2021-03-03T08:47:08.000Z",
"update_time": "2021-03-03T11:01:55.000Z",
"disputed_transactions": [
{
"buyer_transaction_id": "35703532VD052404F",
"seller_transaction_id": "92198049S8582070N",
"create_time": "2021-03-03T08:41:55.000Z",
"transaction_status": "COMPLETED",
"gross_amount": {
"currency_code": "USD",
"value": "29.99"
},
"buyer": {
"name": "John Doe"
},
"seller": {
"email": "sb-47flty3787626#business.example.com",
"merchant_id": "TQNC9P6W9822C",
"name": "John Doe's Test Store"
},
"items": [],
"seller_protection_eligible": true
}
],
"reason": "UNAUTHORISED",
"status": "UNDER_REVIEW",
"dispute_amount": {
"currency_code": "USD",
"value": "29.99"
},
"dispute_life_cycle_stage": "CHARGEBACK",
"dispute_channel": "INTERNAL",
"extensions": {
"buyer_contacted_time": "2021-02-11T17:50:48.000Z"
},
"evidences": [
{
"evidence_type": "OTHER",
"documents": [
{
"name": "ava.jpeg"
}
],
"notes": "Test",
"source": "SUBMITTED_BY_SELLER",
"date": "2021-03-03T11:01:56.000Z",
"action_info": {
"action": "PROVIDE_EVIDENCE"
}
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40523",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40523/provide-supporting-info",
"rel": "provide_supporting_info",
"method": "POST"
}
]
}
Another dispute after claim
{
"dispute_id": "PP-D-40407",
"create_time": "2021-03-02T08:17:07.000Z",
"update_time": "2021-03-02T08:47:05.000Z",
"disputed_transactions": [
{
"buyer_transaction_id": "1VS7234539684123P",
"seller_transaction_id": "2S50928513331053U",
"create_time": "2021-03-02T08:09:49.000Z",
"transaction_status": "COMPLETED",
"gross_amount": {
"currency_code": "USD",
"value": "29.99"
},
"buyer": {
"name": "John Doe"
},
"seller": {
"email": "sb-47flty3787626#business.example.com",
"merchant_id": "TQNC9P6W9822C",
"name": "John Doe's Test Store"
},
"items": [],
"seller_protection_eligible": true
}
],
"reason": "UNAUTHORISED",
"status": "UNDER_REVIEW",
"dispute_amount": {
"currency_code": "USD",
"value": "29.99"
},
"dispute_life_cycle_stage": "CHARGEBACK",
"dispute_channel": "INTERNAL",
"extensions": {
"buyer_contacted_time": "2021-02-11T17:50:48.000Z"
},
"evidences": [
{
"evidence_type": "OTHER",
"documents": [],
"notes": "Refund.",
"source": "SUBMITTED_BY_SELLER",
"date": "2021-03-02T08:47:06.000Z",
"action_info": {
"action": "ACCEPT_CLAIM",
"response_option": "REFUND"
}
}
],
"links": [
{
"href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40407",
"rel": "self",
"method": "GET"
},
{
"href": "https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40407/provide-supporting-info",
"rel": "provide_supporting_info",
"method": "POST"
}
]
}
Adjudicate on dispute with evidence
Request
POST https://api.sandbox.paypal.com/v1/customer/disputes/PP-D-40523/adjudicate
{
"adjudication_outcome": "BUYER_FAVOR"
}
Response
{
"name": "VALIDATION_ERROR",
"message": "Invalid request - see details",
"debug_id": "6aadbbc916b3c",
"information_link": "https://developer.paypal.com/docs/api/customer-disputes/v1/#errors",
"details": [
{
"issue": "ACTION_NOT_ALLOWED_IN_CURRENT_DISPUTE_STATE"
}
],
"links": []
}
You have to get it to an 'UNDER_REVIEW' by PayPal state before you can trigger the adjudication one way or the other.
So if it is 'WAITING_FOR_SELLER_RESPONSE' you should provide evidence; there is a call for that.
You may also need to make an offer and deny the offer, or escalate to claim.
This tool may be useful for understanding the potential steps: https://www.paypal.com/apex/product-profile/customerDisputes/
Sounds like an easy question right?
I want to the ID of the 2 ROOT Folders of BIM360 Docs.
The Plans & Project Folders.
2 Problems.... :(
The first is the ROOT Folders can be renamed inside of BIM360 Docs, so I can look by name or string value. (in the case of the renamed ROOT Folder it is renamed in the NAME and DISPLAYNAME)
The Second is if you use GetTopLevel Folder from Data Management API it gives me all the hidden folders as well.
So the automatic response is to say why not use the attributes of the folders and ignore the hidden folders....... low and behold the attributes of all folders are all set HIDDEN = False. Although clearly some of the folders do not appear in BIM360 Docs, so must be hidden another way.
Has anyone got any suggestions?
Thanks in Advance.
Happy New Year.
If you are calling the top folders API with an OAuth 2.0 Authorization Code Grant access token ("three-legged" token) you should be getting only the "Plans" and "Project Files" folders
Request:
curl -X GET -H "Authorization: Bearer YOUR_JWT_TOKEN"
"https://developer.api.autodesk.com/project/v1/hubs/b.hub.id.123/projects/b.project.id.xyz/topFolders"
Response:
{
"jsonapi": {
"version": "1.0"
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/project/v1/hubs/b.hub.id.123/projects/b.project.id.xyz/topFolders"
}
},
"data": [
{
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg",
"attributes": {
"name": "Plans",
"displayName": "Plans",
"createTime": "2017-06-26T09:27:39.0000000Z",
"createUserId": "",
"createUserName": "",
"lastModifiedTime": "2017-06-26T09:27:39.0000000Z",
"lastModifiedUserId": "",
"lastModifiedUserName": "",
"lastModifiedTimeRollup": "2017-06-26T09:27:39.0000000Z",
"objectCount": 0,
"hidden": false,
"extension": {
"type": "folders:autodesk.bim360:Folder",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
},
"data": {
"visibleTypes": [
"items:autodesk.bim360:Document"
],
"actions": [
"CONVERT",
"SPLIT",
"OCR"
],
"allowedTypes": [
"folders:autodesk.bim360:Folder",
"items:autodesk.bim360:File",
"items:autodesk.bim360:Document",
"items:autodesk.bim360:TitleBlock",
"items:autodesk.bim360:ReviewDocument"
]
}
}
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg"
}
},
"relationships": {
"contents": {
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/contents"
}
}
},
"parent": {
"data": {
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.8w-SI-ggRAuTQcTlD0GK6g"
},
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/parent"
}
}
},
"refs": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/relationships/refs"
},
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/refs"
}
}
},
"links": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.CpjEV04YT_WDKXRkK5uiEg/relationships/links"
}
}
}
}
},
{
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w",
"attributes": {
"name": "Project Files",
"displayName": "Project Files",
"createTime": "2017-06-26T09:27:41.0000000Z",
"createUserId": "",
"createUserName": "",
"lastModifiedTime": "2017-11-08T13:06:58.0000000Z",
"lastModifiedUserId": "XXXXXXXX",
"lastModifiedUserName": "John%20Smith",
"lastModifiedTimeRollup": "2018-01-10T09:09:36.0000000Z",
"objectCount": 6,
"hidden": false,
"extension": {
"type": "folders:autodesk.bim360:Folder",
"version": "1.0",
"schema": {
"href": "https://developer.api.autodesk.com/schema/v1/versions/folders:autodesk.bim360:Folder-1.0"
},
"data": {
"visibleTypes": [
"items:autodesk.bim360:File"
],
"actions": [
"CONVERT"
],
"allowedTypes": [
"items:autodesk.bim360:File",
"folders:autodesk.bim360:Folder"
]
}
}
},
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w"
}
},
"relationships": {
"contents": {
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/contents"
}
}
},
"parent": {
"data": {
"type": "folders",
"id": "urn:adsk.wipprod:fs.folder:co.8w-SI-ggRAuTQcTlD0GK6g"
},
"links": {
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/parent"
}
}
},
"refs": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/relationships/refs"
},
"related": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/refs"
}
}
},
"links": {
"links": {
"self": {
"href": "https://developer.api.autodesk.com/data/v1/projects/b.project.id.xyz/folders/urn:adsk.wipprod:fs.folder:co.q7ElPL9HRTSpVuMP5-xq7w/relationships/links"
}
}
}
}
}
]
}
I want to enable account linking on an Google Assistant application using Actions Sdk.
I have already provided the information in the Account Linking section of the AoG Console :
The grant Type is Authorization code.
I use Auth0 as Oauth Server and i checked that the endpoints are functional.
When the application is invoked using the simulator, the server application send the following json response :
{
"expectUserResponse": true,
"finalResponse": null,
"expectedInputs": [{
"possibleIntents": [{
"intent": "actions.intent.SIGN_IN",
"inputValueData": null
}],
"inputPrompt": {
"richInitialPrompt": {
"items": [{
"simpleResponse": {
"textToSpeech": "Merci de vous authentifier",
"ssml": null,
"displayText": "Merci de vous authentifier"
}
}]
}
}
}],
"conversationToken": null,
"isInSandbox": false
}
I expected then to see the message like : it looks like your account … is not linked
Instead of that, the assistant immediately sends the following request to the server :
{
"user": {
"userId": "ABwppHGK6fClByrbLlS8WDM4xfY0qEck5i_kOGMhlJtuj64SjC-8qDqlH3xZ3BN7f9Yz1JDza-sc",
"locale": "fr-CA",
"lastSeen": "2018-04-23T14:12:02Z"
},
"conversation": {"conversationId": "1524493058716", "type": "NEW"},
"inputs": [{
"intent": "actions.intent.SIGN_IN",
"rawInputs": [{"inputType": "KEYBOARD"}],
"arguments": [{
"name": "SIGN_IN",
"extension": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "ERROR"
}
}]
}],
"surface": {
"capabilities": [
{"name": "actions.capability.WEB_BROWSER"},
{"name": "actions.capability.MEDIA_RESPONSE_AUDIO"},
{"name": "actions.capability.SCREEN_OUTPUT"},
{"name": "actions.capability.AUDIO_OUTPUT"}
]
},
"isInSandbox": true,
"availableSurfaces": [
{
"capabilities": [
{"name": "actions.capability.SCREEN_OUTPUT"},
{"name": "actions.capability.AUDIO_OUTPUT"}
]
}
]
}
Did someone have the same problem ? Thanks
I have a working example, but it might be different of what you are doing because I ask the sign-in with dialogflow Integrations' tab for Google Assistant, and not explicitely with the SDK. The code is for the V2 of Dialogflow, I also have one for the V1 but it is now legacy.
This is my BONJOUR intent that is triggered when my app is launched:
const rp = require('request-promise');
app.intent('BONJOUR', (conv) => {
console.log("Debug: SAY_HELLO");
const accessToken = conv.user.access.token;
console.log("Access Token = "+accessToken);
//========Auth with OAuth website========
if (!accessToken) {
conv.ask(new SignIn());
} else {
let options = {
method: 'GET',
url: '[...]',//Oauth URL
headers:{
authorization: 'Bearer ' + accessToken,
}
};
// I use the RP lib as we need Promises for the V2 of Dialogflow.
return rp(options).then((body) => {
let data = JSON.parse(body);
console.log("auth data ="+JSON.stringify(data));
//You can access the auth data easily here
// For example if you want the name, it's in data.given_name, etc...
//Use conv.ask() to say something here
}).catch((error) => {
console.log("Error in auth request"+error);
})
}
});
Update:
This is my JSON mais the SignIn() is called, as I just tested it, it doesn't work (I created an intent that receives the actions_intent_SIGN_IN event from an example. And it never asks for sign In , I'm always in the else.)
Response {
"payload": {
"google": {
"expectUserResponse": true,
"richResponse": {
"items": [
{
"simpleResponse": {
"textToSpeech": "PLACEHOLDER"
}
}
]
},
"userStorage": "{\"data\":{}}",
"systemIntent": {
"intent": "actions.intent.SIGN_IN",
"data": {
"#type": "type.googleapis.com/google.actions.v2.SignInValueSpec"
}
}
}
},
"outputContexts": [
{
"name": [...],
"lifespanCount": 99,
"parameters": {
"data": "{}"
}
}
]
}
Then the request after that is:
Request {
"responseId": "5a711f0e-be66-4311-b776-2085e81e9bde",
"queryResult": {
"queryText": "actions_intent_SIGN_IN",
"parameters": {},
"allRequiredParamsPresent": true,
"fulfillmentMessages": [
{
"text": {
"text": [
""
]
}
}
],
"outputContexts": [
{
"name": "..."
},
{
"name": ".../actions_intent_sign_in",
"parameters": {
"SIGN_IN": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "ERROR"
}
}
},
{
"name": "...",
"lifespanCount": 98,
"parameters": {
"data": "{}"
}
},
{
"name": "..."
},
{
"name": "..."
},
{
"name": "..."
},
{
"name": "..."
}
],
"intent": {
"name": "...",
"displayName": "Get Signin"
},
"intentDetectionConfidence": 1,
"diagnosticInfo": {},
"languageCode": "fr-fr"
},
"originalDetectIntentRequest": {
"source": "google",
"version": "2",
"payload": {
"isInSandbox": true,
"surface": {
"capabilities": [
{
"name": "actions.capability.WEB_BROWSER"
},
{
"name": "actions.capability.MEDIA_RESPONSE_AUDIO"
},
{
"name": "actions.capability.SCREEN_OUTPUT"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
}
]
},
"inputs": [
{
"rawInputs": [
{
"inputType": "KEYBOARD"
}
],
"arguments": [
{
"extension": {
"#type": "type.googleapis.com/google.actions.v2.SignInValue",
"status": "ERROR"
},
"name": "SIGN_IN"
}
],
"intent": "actions.intent.SIGN_IN"
}
],
"user": {
"userStorage": "{\"data\":{}}",
"lastSeen": "2018-04-24T12:21:19Z",
"locale": "fr-FR",
"userId": "ABwppHHXrOc7N24RC5YS1dMvt7C-MbpzTb5TtzmufeIpGTCINVlReIMb8RKo4SGQMgBY7BUvO1qhn0B-"
},
"conversation": {
"conversationId": "1524572717282",
"type": "ACTIVE",
"conversationToken": "[\"_actions_on_google\"]"
},
"availableSurfaces": [
{
"capabilities": [
{
"name": "actions.capability.SCREEN_OUTPUT"
},
{
"name": "actions.capability.AUDIO_OUTPUT"
}
]
}
]
}
},
"session": "..."
}
I hope it can help you somehow.
I install the followin docker image of cygnus this. And when i try to make a subscription like the tutorial example i got the following error:
POST /v1/subscriptions&ngsi_version=2 not implemented
This is my POST request:
{
"subscription":{
"description": "One subscription to rule them all",
"subject": {
"entities": [
{
"idPattern": ".*",
"type": "Room"
}
],
"condition": {
"attrs": [
"temperature"
],
"expression": {
"q": "temperature>40"
}
}
},
"notification": {
"http": {
"url": "http://localhost:5050"
},
"attrs": [
"temperature",
"humidity"
]
},
"duration": "P1M",
"throttling": 5
},
"endpoint":{
"host":"151.80.41.166",
"port":"50001",
"ssl":"false",
"xauthtoken":"QsENv67AJj7blC2qJ0YvfSc5hMWYrs"
}
}
How i can enable the ngsi_version 2?
I made a JSON API using Laravel with Laravel 5 JSON API Transformer package which was listed on jsonapi.org
For now, everything works as expected, a sample response from my api is like (btw the validation failed so i took a look at the jsonapi specs):
{
"data": [
{
"type": "inventory",
"id": "INV0001",
"attributes": {
"inv_inventory_id": "INV0001",
"inv_owner_company_id": 1,
"inv_owner_department_id": 1,
"inv_user_department_id": 1,
"inv_user_worker_id": 1,
"title": "Schreibtisch"
},
"links": {
"self": {
"href": "http://127.0.0.1:8000/api/v2/inventory/INV0001"
},
"user": {
"href": "http://127.0.0.1:8000/api/v2/worker/1"
},
"owner_dept": {
"href": "http://127.0.0.1:8000/api/v2/department/1"
},
"owner_comp": {
"href": "http://127.0.0.1:8000/api/v2/company/1"
}
},
"relationships": {
"worker": {
"data": {
"type": "worker",
"id": "1"
}
},
"department": {
"data": {
"type": "department",
"id": "1"
}
},
"company": {
"data": {
"type": "company",
"id": "1"
}
}
}
}
],
"included": [
{
"type": "worker",
"id": "1",
"attributes": {
"wrk_forename": "Moritz",
"wrk_surname": "ASDF",
"wrk_department_id": 2,
"wrk_homeoffice": true,
"wrk_room_id": 1
},
"links": {
"self": {
"href": "http://127.0.0.1:8000/api/v2/worker/1"
},
"hardware": {
"href": "http://127.0.0.1:8000/api/v2/worker/1/hardware"
},
"software": {
"href": "http://127.0.0.1:8000/api/v2/worker/1/software"
},
"inventory": {
"href": "http://127.0.0.1:8000/api/v2/worker/1/inventory"
},
"accessory": {
"href": "http://127.0.0.1:8000/api/v2/worker/1/accessory"
}
}
},
{
"type": "department",
"id": "1",
"attributes": {
"department": "Entwicklung",
"dept_floor_id": 3
},
"links": {
"self": {
"href": "http://127.0.0.1:8000/api/v2/department/1"
},
"floor": {
"href": "http://127.0.0.1:8000/api/v2/floor/3"
},
"hardware": {
"href": "http://127.0.0.1:8000/api/v2/department/1/hardware"
},
"software": {
"href": "http://127.0.0.1:8000/api/v2/department/1/software"
},
"inventory": {
"href": "http://127.0.0.1:8000/api/v2/department/1/inventory"
},
"accessory": {
"href": "http://127.0.0.1:8000/api/v2/department/1/accessory"
}
}
},
{
"type": "company",
"id": "1",
"attributes": {
"company": "GermanPersonnel",
"com_building_id": 1
},
"links": {
"self": {
"href": "http://127.0.0.1:8000/api/v2/company/1"
}
}
}
],
"links": {
"self": {
"url": "http://127.0.0.1:8000/api/v2/inventory?page[number]=1&page[size]=10"
},
"first": {
"url": "http://127.0.0.1:8000/api/v2/inventory?page[number]=1&page[size]=10"
},
"last": {
"url": "http://127.0.0.1:8000/api/v2/inventory?page[number]=1&page[size]=10"
}
},
"meta": {
"page": {
"total": 1,
"last": 1,
"number": 1,
"size": 10
}
},
"jsonapi": {
"version": "1.0"
}
}
But according to the specifications on jsonapi.org a link should look like
"links": {
"self": "http://127.0.0.1:8000/api/v2/inventory/INV0001"
},
My question is:
Is it legit to display a link like in my sample ouput as an object
with "href"? I'm pretty confused, because the package i used was
listed on jsonapi.org, but seems not to meet the specs.
BTW: My English might be a little bit confusing, but i hope i descriped my problem as well as possible
This is actually valid JSON API output base on the specification,
http://jsonapi.org/format/#document-links
Where specified, a links member can be used to represent links. The value of each links member MUST be an object (a “links object”).
A Valid Sample From Specification
"links": {
"related": {
"href": "http://example.com/articles/1/comments",
"meta": {
"count": 10
}
}
}
Each member of a links object is a “link”. A link MUST be represented as either:
a string containing the link’s URL.
an object (“link object”) which can contain the following members:
href: a string containing the link’s URL.
meta: a meta object containing non-standard meta-information about the link.
Therefore, your output is actually valid.