want to get approval status for files - autodesk

I'm trying to get the status, type, and set that a document is in. I'm making the call to the data/v1/projects/{projectId}/items/{itemId}/versions endpoint
While looking at the UI I noticed that one of the endpoints the UI uses
https://developer.api.autodesk.com/dm/v1/projects/801f898a-4cc9-42cd-a56b-4e4b9ca0a054/folders/urn%3Aadsk.wipemea%3Afs.folder%3Aco.mgQJS4w7SUOx5EbM4gVJBA/documents?entity_types=SEED_FILE&limit=200&offset=0
contain some of the info I need
{
"urn": "urn:adsk.wipemea:dm.lineage:sdpW01kQRVyGOhKFIvkELA",
"create_time": "2021-02-01T08:42:06+0000",
"create_user_id": "SE6ZLLDDEY9R",
"create_user_name": "MICHAEL LEIPPER",
"last_modified_time": "2021-02-01T08:42:07+0000",
"last_modified_user_id": "SE6ZLLDDEY9R",
"last_modified_user_name": "MICHAEL LEIPPER",
"delete_by": null,
"delete_at": null,
"title_block_id": null,
"title_block_image": null,
"file_name": "happy-familyNHS (1).jpg",
"id": "b1da56d3-5910-455c-863a-128522f9042c",
"name": "happy-familyNHS (1).jpg",
"description": "",
"hidden": false,
"move_state": null,
"cde_is_master": null,
"custom_attributes": [],
"current_version": {
"create_time": "2021-02-01T08:42:06+0000",
"update_time": "2021-02-09T10:42:15+0000",
"created_by": "MICHAEL LEIPPER",
"updated_by": "MICHAEL LEIPPER",
"create_user_name": "MICHAEL LEIPPER",
"create_user_id": "SE6ZLLDDEY9R",
"update_user_id": "SE6ZLLDDEY9R",
"storage_urn": "urn:adsk.objects:os.object:wip.dm.emea.2/4b48ee2d-78fd-4e17-876c-48400c9cf6b6.jpg",
"urn": "urn:adsk.wipemea:fs.file:vf.sdpW01kQRVyGOhKFIvkELA?version=1",
"states": [
"CONTENT_AVAILABLE"
],
"name": "happy-familyNHS (1).jpg",
"title": "happy-familyNHS (1).jpg",
"mime_type": null,
"revision_number": 1,
"title_block_id": null,
"original_name": null,
"file_name": "happy-familyNHS (1).jpg",
"custom_attributes": [],
"sets": [],
"approve_status": {
"id": "2715ab6c-46b8-4493-b48a-426056e93cae",
"value": "approved",
"label": "Approved As built",
"iconValue": "approved-check",
"buildIn": false,
"approverUserId": "SE6ZLLDDEY9R",
"approverUserName": "MICHAEL LEIPPER"
},
"translation_states": "none",
"translation_has_thumbnail": false,
"forge_type": null,
"forged_is_composite_design": null,
"entity_type": "SEED_FILE",
"bubble_viewable_guid": null,
"bubble_viewable_id": null,
"bubble_viewable_order": null,
"bubble_viewable_resource_mimetype": null,
"bubble_viewable_resource_urn": null,
"bubble_urn": "urn:adsk.wipemea:fs.file:vf.sdpW01kQRVyGOhKFIvkELA?version=1",
"process_state": "PROCESSING_COMPLETE",
"extraction_state": "SUCCESS",
"splitting_state": "NOT_SPLIT",
"review_id": null,
"review_state": "NOT_IN_REVIEW",
"review_new_document_count": null,
"review_matched_document_count": null,
"review_deleted": null,
"action": null,
"partial_extraction_failure": null,
"move_state": null,
"dm_command_id": "ad123f4d-04df-4620-b733-316d346856cf",
"id": "6986e92e-7a83-4769-9101-e8a5615568c8",
"file_size": 136688,
"process_result": "PROCESSING_SUCCESS"
},
"current_set_version": 0,
"reserved": false,
"reserved_user_name": null,
"reserved_user_id": null,
"reserved_at": null,
"latest_version": 1,
"latest_version_file_state": [
"CONTENT_AVAILABLE"
],
"latest_version_create_time": "2021-02-01T08:42:06+0000",
"current_version_urn": "urn:adsk.wipemea:fs.file:vf.sdpW01kQRVyGOhKFIvkELA?version=1",
"latest_storage_urn": "urn:adsk.objects:os.object:wip.dm.emea.2/4b48ee2d-78fd-4e17-876c-48400c9cf6b6.jpg",
"parent_folder_urn": "urn:adsk.wipemea:fs.folder:co.mgQJS4w7SUOx5EbM4gVJBA",
"origin_folder_urn": null,
"folder_set_urn": null,
"latest_versioned_file_urn": "urn:adsk.wipemea:fs.file:vf.sdpW01kQRVyGOhKFIvkELA?version=1"
},
As can be seen this has approve_status in the return object. I know that this endpoint is private and not available publicly, however, is there a way to get these approval statuses for each file.
Any help is greatly appreciated.

Sounds like you are looking for BIM 360 Docs Review and Set API. Unfortunately, there is no public API and they are still under wish:
ALEX-37150: “API wish: expose Docs Review API”
ALEX-24690: “Expose BIM 360 SET via DM API”
Sorry for the bad news.
I will add your name to the wish log above. In this context, you are interested in read access to those?

Related

How can I get a value from a json data in PLSQL [duplicate]

This question already has answers here:
How can I parse JSON string in PL/SQL
(4 answers)
How to parse json in oracle sql? (Version:11.2.0) [duplicate]
(1 answer)
Closed 7 months ago.
Please If I have a CLOB data like this, how can I assign the value of let's saydata.provider from the CLOB data to a variable in PLSQL?
{
"status": "Successful",
"message": "Transaction processed successfully",
"data": {
"provider_response_code": "00",
"provider": "Fidelity",
"errors": null,
"error": null,
"provider_response": {
"destination_institution_code": "076",
"beneficiary_account_name": "JAMES BLUE",
"beneficiary_account_number": "0099880099",
"beneficiary_kyc_level": "",
"originator_account_name": "",
"originator_account_number": "1100009909",
"originator_kyc_level": "",
"narration": "A random transaction",
"transaction_final_amount": 1000,
"reference": "C3DA541CA20740659031949CD3441EBE",
"payment_id": "382FTTP2005901LD"
},
"client_info": {
"name": null,
"id": null,
"bank_cbn_code": null,
"bank_name": null,
"console_url": null,
"js_background_image": null,
"css_url": null,
"logo_url": null,
"footer_text": null,
"show_options_icon": false,
"paginate": false,
"paginate_count": 0,
"options": null,
"merchant": null,
"colors": null,
"meta": null
}
}
}

need struct type but got string: Cannot extract value

I have a tricky scenario that I need help with, I have to extract information from a field.
The Data set can EITHER look like this:
"orderDelivery": {
"id":123,
"deliveryFee": 3500,
"deliveryFeeExcludingVAT": 3500,
"deliveryFeeRefunded": true,
"immediatedeliveryselected": true,
"deliverySlotId": null,
"deliverySlotChanged": false,
"driver": null,
"storeCollectionSLATime": 1635759479391,
"storeArrivalTimeEstimate": null,
"storeArrivalTimeActual": null,
"timeDelivered": null,
"timeCollected": null,
"DeliveryEstimates": [
{
"estimatedDeliveryTime": 1635762179390,
"createdOn": 1635758579390
}
],
"instructions": null,
"deliveryInstructions": null,
"deliveryPartnerCommunication": {
"informedOfNewOrder": true,
"serviceMessage": null
},
"deliveryIssueIds": null
}
Or it can look like this:
"orderDelivery": {
"id":1234,
"deliveryFee": 3500,
"deliveryFeeExcludingVAT": 3500,
"deliveryFeeRefunded": true,
"immediatedeliveryselected": true,
"deliverySlotId": null,
"deliverySlotChanged": false,
"driver": null,
"storeCollectionSLATime": 1635759479391,
"storeArrivalTimeEstimate": null,
"storeArrivalTimeActual": null,
"timeDelivered": null,
"timeCollected": null,
"DeliveryEstimates": [
{
"estimatedDeliveryTime": 1635762179390,
"createdOn": 1635758579390
}
],
"instructions": null,
"deliveryInstructions": [
{
"createdOn": 1635762179390,
"deliveryMessage": "delivered"
},
{
"createdOn": 1735762179390,
"deliveryMessage": "not door"
}
],
"deliveryPartnerCommunication": {
"informedOfNewOrder": true,
"serviceMessage": null
},
"deliveryIssueIds": null
}
I need to take into account when deliveryInstructions is null or when it is an array.
I am extracting the data like this:
df["orderDelivery"]["deliveryInstructions"]["createdOn"].cast(StringType()).alias("created_on")
And I am also extracting like this :
df["orderDelivery"]["deliveryInstructions"]["deliveryMessage"].cast(StringType()).alias("delivery_message")
When I query it when is null, I get the following error:
Can't extract value from orderDelivery#27.deliveryInstructions: need struct type but got
string
Can anyone help on how to handle this?
also when when delivery instruction repeats I want it look like this
id
createdOn
deliveryMessage
1234
1635762179390
delivered
1234
1735762179390
Not door
There can be one or more delivery instructions in addition to the null value.
If it's null then I just want null for both CreatedOn and DeliveryMessage

How to parse unnest json data using cypher query language to neo4j database?

In the below json file I want to access "934934507945312256", "934934503604174848",.... and then the keys inside them.
But after using UNWIND clause I am unable to access the data of these keys(quote_count,reply_count,etc.) as these keys("934934507945312256" ,"934934503604174848",...) are randomly generated.
{
"934934507945312256": {
"quote_count": 0,
"reply_count": 0,
"hashtags": null,
"datetime": "2017-11-26 23:58:51",
"date": "2017-11-26",
"like_count": 0,
"verified": "False",
"sentiment": 0,
"author": "Judy💯The Resistance",
"location": "Hollywood, California USA🇺🇸",
"tid": "934934507945312256",
"retweet_count": 0,
"type": "retweet",
"media_list": null,
"quoted_source_id": null,
"url_list": null,
"tweet_text": "RT #kylegriffin1: Reminder: The Senate Judiciary Committee gave Jared Kushner a November 27 deadline to turn over the missing records… ",
"author_profile_image": "https://pbs.twimg.com/profi...",
"author_screen_name": "jgirl66",
"author_id": "23737528",
"lang": "en",
"keywords_processed_list": [
"reminder",
"senate judiciary committee",
"kushner november",
"deadline"
],
"retweet_source_id": "934872065471115264",
"mentions": [
"kylegriffin1"
],
"replyto_source_id": null
},
"934934503604174848": {
"quote_count": 0,
"reply_count": 2,
"hashtags": [
"MissUniverse",
"Thailand"
],
"datetime": "2017-11-26 23:58:50",
"date": "2017-11-26",
"like_count": 38,
"verified": "False",
"sentiment": 0,
"author": "P'Hmee7.5",
"location": "Bangkok, Thailand",
"tid": "934934503604174848",
"retweet_count": 105,
"type": "Tweet",
"media_list": null,
"quoted_source_id": null,
"url_list": null,
"tweet_text": "รอโหวต มรญ #MissUniverse #Thailand",
"author_profile_image": "
Thumbnail
",
"author_screen_name": "Peehmee75",
"author_id": "700720806972624897",
"lang": "th",
"keywords_processed_list": null,
"retweet_source_id": null,
"mentions": null,
"replyto_source_id": null
},
"934934336381636608": {
"quote_count": 0,
"reply_count": 0,
"hashtags": null,
"datetime": "2017-11-26 23:58:10",
"date": "2017-11-26",
"like_count": 0,
"verified": "False",
"sentiment": 0,
"author": "selfresqingprncess",
"location": "Maine, USA",
"tid": "934934336381636608",
"retweet_count": 0,
"type": "retweet",
"media_list": null,
"quoted_source_id": null,
"url_list": null,
"tweet_text": "RT #kylegriffin1: Reminder: The Senate Judiciary Committee gave Jared Kushner a November 27 deadline to turn over the missing records… ",
"author_profile_image": "https://pbs.twimg.com/profi...",
"author_screen_name": "slfresqngprncss",
"author_id": "100536014",
"lang": "en",
"keywords_processed_list": [
"reminder",
"keywords_processed_list": [
"reminder",
"senate judiciary committee",
"kushner november",
"deadline"
],
"retweet_source_id": "934872065471115264",
"mentions": [
"kylegriffin1"
],
"replyto_source_id": null
}
}
There's I have tried :-
query = """
with {json} as data UNWIND data as doc FOREACH( l in doc| MERGE (label1:Label1 {author:l.author}))
"""
But I am getting error:- Cannot merge node using null property value for author.
Your JSON file is malformed.
A JSON string cannot contain control characters (like carriage returns or linefeeds). And your JSON contains an extraneous section (that is probably a copy/paste error):
"keywords_processed_list": [
"reminder",
Furthermore, UNWIND can only be used with lists. You cannot use it to get the properties from a map. Once you have fixed your JSON errors, try the following query (I assume that json is a parameter whose value is your JSON data):
UNWIND KEYS($json) AS k
MERGE(label1:Label1 {author: $json[k].author})

Stripe API parsing JSON objects

I'm getting a bit confused when retrueving card information. I get the card data like this:
card_data = customer.sources.list(limit=3, object='card')
card = card_data['data']
print(card)
And this is what is printed:
[<Card card id=card_1DPKYtAuBx2mXUsrmQG0gHMz at 0x54d8420> JSON: {
"address_city": null,
"address_country": null,
"address_line1": null,
"address_line1_check": null,
"address_line2": null,
"address_state": null,
"address_zip": "42424",
"address_zip_check": "pass",
"brand": "Visa",
"country": "US",
"customer": "cus_Dqyu8HKCIQnUIA",
"cvc_check": "pass",
"dynamic_last4": null,
"exp_month": 4,
"exp_year": 2024,
"fingerprint": "TuMlU4wS6zLVngGc",
"funding": "credit",
"id": "card_1DPKYtAuBx2mXUsrmQG0gHMz",
"last4": "4242",
"metadata": {},
"name": null,
"object": "card",
"tokenization_method": null
}]
I'm unable to parse this data as if it were normal json "card['id']". How do I go about getting data from the fields?
The card you got from card = card_data['data'] is an array. You could get the id by card[0]['id']
Give it a try
Thanks

jq, search for a 'sections' basing on a value of an attribute

I am new in this stuff,
I have input json:
{
"2017-09-15": {
"key": "stops",
"node": {
"lastUpdate": "2017-09-15 05:15:26",
"stops": [
{
"stopId": 11000,
"stopCode": null,
"stopName": null,
"stopShortName": "1000",
"stopDesc": "Tom Tail",
"subName": "1000",
"zoneId": null,
"zoneName": null,
"stopUrl": "",
"locationType": null,
"parentStation": null,
"stopTimezone": "",
"wheelchairBoarding": null,
"virtual": null,
"nonpassenger": null,
"depot": null,
"ticketZoneBorder": null,
"onDemand": null,
"activationDate": "2017-09-14"
},
{
"stopId": 1100,
"stopCode": "04",
"stopName": "One Three",
"stopShortName": "1100",
"stopDesc": "Big Wall",
"subName": "04",
"zoneId": 1,
"zoneName": "Demo2",
"stopUrl": "",
"locationType": null,
"parentStation": null,
"stopTimezone": "",
"wheelchairBoarding": null,
"virtual": 0,
"nonpassenger": 0,
"depot": 0,
"ticketZoneBorder": 0,
"onDemand": 0,
"activationDate": "2017-09-24"
}
]
}
}
}
I can get all stops by filter:
jq -r '.[].node.stops' json
but how to search for a specific stop, for example basing on stopDescr - exact name or containing a string?
thx.
You're on the right track ...
.[].node.stops[] | select(.stopDesc == "Big Wall")
unique
Regarding the supplementary question:
1) sort and unique both expect arrays as input
2) calling unique obviates the need to call sort
3) unique produces an array, so you might want to use unique[]
4) One way to convert a stream of (JSON) values to an array is to wrap the expression producing the stream in square brackets.
Here is an example:
[.[].node.stops[] | select(.stopDesc == "Big Wall") | .zoneName]
| unique