Get BIM 360 Docs Project and Plans Folders - rest

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"
}
}
}
}
}
]
}

Related

How to make the file sent only once and not duplicated? Function App and blob storage container

I have this function App and I get the file once when I put one file on blob storage container!
when I put 2 files, I get 4 files in my email addressee and the same file twice ! when I put 3 files I get 9 files , the same file duplicated 3 times , and when I put 4 files I get 16 files and the same file duplicated 4 times , how to resolve this ?
this my function app :
As the Send an email (V2) connector is in for each loop of Lists blob's value, you are receiving everything in duplicate as it iterates all over the folder/container that you have set. After reproducing from our end this was working when we have changed Get Blob's Blob path to List of Files Path of When a blob is added or modified (properties only) (V2) and also use When a blob is added or modified (properties only) (V2) content in Send email too, we could receive emails on current item one time.
Here is the schema of my logic app
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Get_blob_content_(V2)_2": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/files/#{encodeURIComponent(encodeURIComponent(triggerBody()?['Path']))}/content",
"queries": {
"inferContentType": true
}
},
"runAfter": {
"Lists_blobs_(V2)": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Lists_blobs_(V2)": {
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/foldersV2/#{encodeURIComponent(encodeURIComponent('JTJmY29udGFpbmVyMQ=='))}",
"queries": {
"nextPageMarker": "",
"useFlatListing": false
}
},
"metadata": {
"JTJmY29udGFpbmVyMQ==": "/container1"
},
"runAfter": {},
"type": "ApiConnection"
},
"Send_an_email_(V2)": {
"inputs": {
"body": {
"Body": "<p>#{triggerBody()}</p>",
"Subject": "#triggerBody()?['DisplayName']",
"To": "<To email id>"
},
"host": {
"connection": {
"name": "#parameters('$connections')['office365']['connectionId']"
}
},
"method": "post",
"path": "/v2/Mail"
},
"runAfter": {
"Get_blob_content_(V2)_2": [
"Succeeded"
]
},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_blob_is_added_or_modified_(properties_only)_(V2)": {
"evaluatedRecurrence": {
"frequency": "Second",
"interval": 1
},
"inputs": {
"host": {
"connection": {
"name": "#parameters('$connections')['azureblob']['connectionId']"
}
},
"method": "get",
"path": "/v2/datasets/#{encodeURIComponent(encodeURIComponent('AccountNameFromSettings'))}/triggers/batch/onupdatedfile",
"queries": {
"checkBothCreatedAndModifiedDateTime": false,
"folderId": "JTJmY29udGFpbmVyMQ=="
}
},
"metadata": {
"JTJmY29udGFpbmVyMQ==": "/container1"
},
"recurrence": {
"frequency": "Second",
"interval": 1
},
"splitOn": "#triggerBody()",
"type": "ApiConnection"
}
}
},
"parameters": {
"$connections": {
"value": {
"azureblob": {
"connectionId": "/subscriptions/***/resourceGroups/***/providers/Microsoft.Web/connections/azureblob",
"connectionName": "azureblob",
"id": "/subscriptions/***/providers/Microsoft.Web/locations/centralus/managedApis/azureblob"
},
"office365": {
"connectionId": "/subscriptions/***/resourceGroups/***/providers/Microsoft.Web/connections/office365",
"connectionName": "office365",
"id": "/subscriptions/***/providers/Microsoft.Web/locations/centralus/managedApis/office365"
}
}
}
}
}

Paypal disputes sandbox testing, trigger CUSTOMER.DISPUTE.RESOLVED event

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/

Find if array has a value and then copy id from that array

I'm working on a script in Okta and am trying to return only specific data. Is it possible to look to see if the value of factorType is equal to sms then to get the corresponding ID?
This is an example of what I am being returned:
[
{
"id": "ufs2bysphxKODSZKWVCT",
"factorType": "question",
"provider": "OKTA",
"vendorName": "OKTA",
"status": "ACTIVE",
"created": "2014-04-15T18:10:06.000Z",
"lastUpdated": "2014-04-15T18:10:06.000Z",
"profile": {
"question": "favorite_art_piece",
"questionText": "What is your favorite piece of art?"
},
"_links": {
"questions": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/questions",
"hints": {
"allow": [
"GET"
]
}
},
"self": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ufs2bysphxKODSZKWVCT",
"hints": {
"allow": [
"GET",
"DELETE"
]
}
},
"user": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL",
"hints": {
"allow": [
"GET"
]
}
}
}
},
{
"id": "ostf2gsyictRQDSGTDZE",
"factorType": "token:software:totp",
"provider": "OKTA",
"status": "PENDING_ACTIVATION",
"created": "2014-06-27T20:27:33.000Z",
"lastUpdated": "2014-06-27T20:27:33.000Z",
"profile": {
"credentialId": "dade.murphy#example.com"
},
"_links": {
"next": {
"name": "activate",
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE/lifecycle/activate",
"hints": {
"allow": [
"POST"
]
}
},
"self": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE",
"hints": {
"allow": [
"GET"
]
}
},
"user": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL",
"hints": {
"allow": [
"GET"
]
}
}
},
"_embedded": {
"activation": {
"timeStep": 30,
"sharedSecret": "HE64TMLL2IUZW2ZLB",
"encoding": "base32",
"keyLength": 16
}
}
},
{
"id": "sms2gt8gzgEBPUWBIFHN",
"factorType": "sms",
"provider": "OKTA",
"status": "ACTIVE",
"created": "2014-06-27T20:27:26.000Z",
"lastUpdated": "2014-06-27T20:27:26.000Z",
"profile": {
"phoneNumber": "+1-555-415-1337"
},
"_links": {
"verify": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN/verify",
"hints": {
"allow": [
"POST"
]
}
},
"self": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN",
"hints": {
"allow": [
"GET",
"DELETE"
]
}
},
"user": {
"href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL",
"hints": {
"allow": [
"GET"
]
}
}
}
}
]
As #IronMan commented, use ConvertFrom-Json to create an object. Then you can filter/select as desired.
$str = '[ { "id": "ufs2bysphxKODSZKWVCT", "factorType": "question", "provider": "OKTA", "vendorName": "OKTA", "status": "ACTIVE", "created": "2014-04-15T18:10:06.000Z", "lastUpdated": "2014-04-15T18:10:06.000Z", "profile": { "question": "favorite_art_piece", "questionText": "What is your favorite piece of art?" }, "_links": { "questions": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/questions", "hints": { "allow": [ "GET" ] } }, "self": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ufs2bysphxKODSZKWVCT", "hints": { "allow": [ "GET", "DELETE" ] } }, "user": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL", "hints": { "allow": [ "GET" ] } } } }, { "id": "ostf2gsyictRQDSGTDZE", "factorType": "token:software:totp", "provider": "OKTA", "status": "PENDING_ACTIVATION", "created": "2014-06-27T20:27:33.000Z", "lastUpdated": "2014-06-27T20:27:33.000Z", "profile": { "credentialId": "dade.murphy#example.com" }, "_links": { "next": { "name": "activate", "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE/lifecycle/activate", "hints": { "allow": [ "POST" ] } }, "self": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE", "hints": { "allow": [ "GET" ] } }, "user": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL", "hints": { "allow": [ "GET" ] } } }, "_embedded": { "activation": { "timeStep": 30, "sharedSecret": "HE64TMLL2IUZW2ZLB", "encoding": "base32", "keyLength": 16 } } }, { "id": "sms2gt8gzgEBPUWBIFHN", "factorType": "sms", "provider": "OKTA", "status": "ACTIVE", "created": "2014-06-27T20:27:26.000Z", "lastUpdated": "2014-06-27T20:27:26.000Z", "profile": { "phoneNumber": "+1-555-415-1337" }, "_links": { "verify": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN/verify", "hints": { "allow": [ "POST" ] } }, "self": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN", "hints": { "allow": [ "GET", "DELETE" ] } }, "user": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL", "hints": { "allow": [ "GET" ] } } } } ]'
$obj = $str | ConvertFrom-Json
$obj | Where-Object factorType -eq 'sms' | Select-Object -ExpandProperty id
or
$str = '[ { "id": "ufs2bysphxKODSZKWVCT", "factorType": "question", "provider": "OKTA", "vendorName": "OKTA", "status": "ACTIVE", "created": "2014-04-15T18:10:06.000Z", "lastUpdated": "2014-04-15T18:10:06.000Z", "profile": { "question": "favorite_art_piece", "questionText": "What is your favorite piece of art?" }, "_links": { "questions": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/questions", "hints": { "allow": [ "GET" ] } }, "self": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ufs2bysphxKODSZKWVCT", "hints": { "allow": [ "GET", "DELETE" ] } }, "user": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL", "hints": { "allow": [ "GET" ] } } } }, { "id": "ostf2gsyictRQDSGTDZE", "factorType": "token:software:totp", "provider": "OKTA", "status": "PENDING_ACTIVATION", "created": "2014-06-27T20:27:33.000Z", "lastUpdated": "2014-06-27T20:27:33.000Z", "profile": { "credentialId": "dade.murphy#example.com" }, "_links": { "next": { "name": "activate", "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE/lifecycle/activate", "hints": { "allow": [ "POST" ] } }, "self": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/ostf2gsyictRQDSGTDZE", "hints": { "allow": [ "GET" ] } }, "user": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL", "hints": { "allow": [ "GET" ] } } }, "_embedded": { "activation": { "timeStep": 30, "sharedSecret": "HE64TMLL2IUZW2ZLB", "encoding": "base32", "keyLength": 16 } } }, { "id": "sms2gt8gzgEBPUWBIFHN", "factorType": "sms", "provider": "OKTA", "status": "ACTIVE", "created": "2014-06-27T20:27:26.000Z", "lastUpdated": "2014-06-27T20:27:26.000Z", "profile": { "phoneNumber": "+1-555-415-1337" }, "_links": { "verify": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN/verify", "hints": { "allow": [ "POST" ] } }, "self": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL/factors/sms2gt8gzgEBPUWBIFHN", "hints": { "allow": [ "GET", "DELETE" ] } }, "user": { "href": "https://${yourOktaDomain}/api/v1/users/00u15s1KDETTQMQYABRL", "hints": { "allow": [ "GET" ] } } } } ]'
($str | ConvertFrom-Json) | Where-Object factorType -eq 'sms' | Select-Object -ExpandProperty id

Openstack Create server request don't work via api

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"
}
]
}
]
}

JSON API: Correct way to show links?

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.