BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
brendanb
Obsidian | Level 7

Hi,

I am trying to create a reference list in visual investigator using Studio running a proc http. I got an example body construct from https://developer.sas.com/apis/vi/rest/VisualInvestigator/#sas-visual-investigator-data-hub-rest-api... my error says that my request is malformed. Please can someone assist. Appreciated.

Below is an example of the request and error.

 

REQUEST------START--------------------------------------
{
"id": "TESTID1",
"createdBy": "userid",
"createdAt": "2021-11-04T14:15:22Z",
"lastUpdatedBy": "userid",
"lastUpdatedAt": "2021-11-04T14:15:22Z",
"label": "LABEL-A",
"description": "DESCRIPTION-0",
"localizedLabels": [
{
"id": "TESTID2",
"createdBy": "userid",
"createdAt": "2021-11-04T14:15:22Z",
"lastUpdatedBy": "userid",
"lastUpdatedAt": "2021-11-04T14:15:22Z",
"version": 0,
"locale": "en-US",
"label": "LABEL-B"
}
],
"localizedDescriptions": [
{
"id": "TESTID3",
"createdBy": "userid",
"createdAt": "2021-11-04T14:15:22Z",
"lastUpdatedBy": "userid",
"lastUpdatedAt": "2021-11-04T14:15:22Z",
"version": 0,
"locale": "en-US",
"description": "DESCRIPTION-1"
}
],
"name": "CONFIDENCE",
"archived": true,
"maxCodeLength": "32",
"alphabeticalSort": true,
"items": [
{
"id": "TESTID4",
"createdBy": "userid",
"createdAt": "2021-11-04T14:15:22Z",
"lastUpdatedBy": "userid",
"lastUpdatedAt": "2021-11-04T14:15:22Z",
"label": "LABEL-C",
"description": "DESCRIPTION-A",
"localizedLabels": [
{
"id": "TESTID5",
"createdBy": "userid",
"createdAt": "2021-11-04T14:15:22Z",
"lastUpdatedBy": "userid",
"lastUpdatedAt": "2021-11-04T14:15:22Z",
"version": 0,
"locale": "en-US",
"label": "LABEL-D"
}
],
"localizedDescriptions": [
{
"id": "TESTID6",
"createdBy": "userid",
"createdAt": "2021-11-04T14:15:22Z",
"lastUpdatedBy": "userid",
"lastUpdatedAt": "2021-11-04T14:15:22Z",
"version": 0,
"locale": "en-US",
"description": "DESCRIPTION-B"
}
],
"code": "CODE1",
"archived": true,
"displayIndex": 0
}
]
}

 

REQUEST------END--------------------------------------




%studio_hide_wrapper;
82
83 /* list reference lists */
84 proc http
85 url="&server_url./svi-datahub/admin/lists"
86 AUTH_BASIC
87 Method="POST"
88 in=sfile
89 out=sfile_r
90 WEBUSERNAME="sas.ec" /* webusername of sas.ec is required for this request??? */
91 WEBPASSWORD=XX ;
92 debug level=3
93
94 ;
95 headers
96 "Content-Type"="application/json"
97 "Accept"="application/json"
98 "Authorization"= "bearer &auth_token";
NOTE: The quoted string currently being processed has become more than 262 bytes long. You might have unbalanced quotation marks.
99 ;
100 run;
> POST /svi-datahub/admin/lists HTTP/1.1
> User-Agent: SAS/9
> Host: croit.frm-rbviesmpp.fnb.co.za
> Connection: Keep-Alive
> Content-Length: 1517
> Content-Type: application/json
> Accept: application/json
> Authorization: ************
>
> 00007F07682F24C0: 7B 0A 22 69 64 22 3A 20 22 54 45 53 54 49 44 31 {."id": "TESTID1
> 00007F07682F24D0: 22 2C 0A 22 63 72 65 61 74 65 64 42 79 22 3A 20 ",."createdBy":
> 00007F07682F24E0: 22 66 34 38 37 35 30 35 32 22 2C 0A 22 63 72 65 "f4875052",."cre
> 00007F07682F24F0: 61 74 65 64 41 74 22 3A 20 22 32 30 32 31 2D 31 atedAt": "2021-1
> 00007F07682F2500: 31 2D 30 34 54 31 34 3A 31 35 3A 32 32 5A 22 2C 1-04T14:15:22Z",
> 00007F07682F2510: 0A 22 6C 61 73 74 55 70 64 61 74 65 64 42 79 22 ."lastUpdatedBy"
> 00007F07682F2520: 3A 20 22 66 34 38 37 35 30 35 32 22 2C 0A 22 6C : "f4875052",."l
> 00007F07682F2530: 61 73 74 55 70 64 61 74 65 64 41 74 22 3A 20 22 astUpdatedAt": "
> 00007F07682F2540: 32 30 32 31 2D 31 31 2D 30 34 54 31 34 3A 31 35 2021-11-04T14:15
> 00007F07682F2550: 3A 32 32 5A 22 2C 0A 22 6C 61 62 65 6C 22 3A 20 :22Z",."label":
> 00007F07682F2560: 22 4C 41 42 45 4C 2D 41 22 2C 0A 22 64 65 73 63 "LABEL-A",."desc
> 00007F07682F2570: 72 69 70 74 69 6F 6E 22 3A 20 22 44 45 53 43 52 ription": "DESCR
> 00007F07682F2580: 49 50 54 49 4F 4E 2D 30 22 2C 0A 22 6C 6F 63 61 IPTION-0",."loca
> 00007F07682F2590: 6C 69 7A 65 64 4C 61 62 65 6C 73 22 3A 20 5B 0A lizedLabels": [.
> 00007F07682F25A0: 7B 0A 22 69 64 22 3A 20 22 54 45 53 54 49 44 32 {."id": "TESTID2
> 00007F07682F25B0: 22 2C 0A 22 63 72 65 61 74 65 64 42 79 22 3A 20 ",."createdBy":
> 00007F07682F25C0: 22 66 34 38 37 35 30 35 32 22 2C 0A 22 63 72 65 "f4875052",."cre
> 00007F07682F25D0: 61 74 65 64 41 74 22 3A 20 22 32 30 32 31 2D 31 atedAt": "2021-1
> 00007F07682F25E0: 31 2D 30 34 54 31 34 3A 31 35 3A 32 32 5A 22 2C 1-04T14:15:22Z",
> 00007F07682F25F0: 0A 22 6C 61 73 74 55 70 64 61 74 65 64 42 79 22 ."lastUpdatedBy"
> 00007F07682F2600: 3A 20 22 66 34 38 37 35 30 35 32 22 2C 0A 22 6C : "f4875052",."l
> 00007F07682F2610: 61 73 74 55 70 64 61 74 65 64 41 74 22 3A 20 22 astUpdatedAt": "
> 00007F07682F2620: 32 30 32 31 2D 31 31 2D 30 34 54 31 34 3A 31 35 2021-11-04T14:15
> 00007F07682F2630: 3A 32 32 5A 22 2C 0A 22 76 65 72 73 69 6F 6E 22 :22Z",."version"
> 00007F07682F2640: 3A 20 30 2C 0A 22 6C 6F 63 61 6C 65 22 3A 20 22 : 0,."locale": "
> 00007F07682F2650: 65 6E 2D 55 53 22 2C 0A 22 6C 61 62 65 6C 22 3A en-US",."label":
> 00007F07682F2660: 20 22 4C 41 42 45 4C 2D 42 22 0A 7D 0A 5D 2C 0A "LABEL-B".}.],.
> 00007F07682F2670: 22 6C 6F 63 61 6C 69 7A 65 64 44 65 73 63 72 69 "localizedDescri
> 00007F07682F2680: 70 74 69 6F 6E 73 22 3A 20 5B 0A 7B 0A 22 69 64 ptions": [.{."id
> 00007F07682F2690: 22 3A 20 22 54 45 53 54 49 44 33 22 2C 0A 22 63 ": "TESTID3",."c
> 00007F07682F26A0: 72 65 61 74 65 64 42 79 22 3A 20 22 66 34 38 37 reatedBy": "f487
> 00007F07682F26B0: 35 30 35 32 22 2C 0A 22 63 72 65 61 74 65 64 41 5052",."createdA
> 00007F07682F26C0: 74 22 3A 20 22 32 30 32 31 2D 31 31 2D 30 34 54 t": "2021-11-04T
> 00007F07682F26D0: 31 34 3A 31 35 3A 32 32 5A 22 2C 0A 22 6C 61 73 14:15:22Z",."las
> 00007F07682F26E0: 74 55 70 64 61 74 65 64 42 79 22 3A 20 22 66 34 tUpdatedBy": "f4
> 00007F07682F26F0: 38 37 35 30 35 32 22 2C 0A 22 6C 61 73 74 55 70 875052",."lastUp
> 00007F07682F2700: 64 61 74 65 64 41 74 22 3A 20 22 32 30 32 31 2D datedAt": "2021-
> 00007F07682F2710: 31 31 2D 30 34 54 31 34 3A 31 35 3A 32 32 5A 22 11-04T14:15:22Z"
> 00007F07682F2720: 2C 0A 22 76 65 72 73 69 6F 6E 22 3A 20 30 2C 0A ,."version": 0,.
> 00007F07682F2730: 22 6C 6F 63 61 6C 65 22 3A 20 22 65 6E 2D 55 53 "locale": "en-US
> 00007F07682F2740: 22 2C 0A 22 64 65 73 63 72 69 70 74 69 6F 6E 22 ",."description"
> 00007F07682F2750: 3A 20 22 44 45 53 43 52 49 50 54 49 4F 4E 2D 31 : "DESCRIPTION-1
> 00007F07682F2760: 22 0A 7D 0A 5D 2C 0A 22 6E 61 6D 65 22 3A 20 22 ".}.],."name": "
> 00007F07682F2770: 43 4F 4E 46 49 44 45 4E 43 45 22 2C 0A 22 61 72 CONFIDENCE",."ar
> 00007F07682F2780: 63 68 69 76 65 64 22 3A 20 74 72 75 65 2C 0A 22 chived": true,."
> 00007F07682F2790: 6D 61 78 43 6F 64 65 4C 65 6E 67 74 68 22 3A 20 maxCodeLength":
> 00007F07682F27A0: 22 33 32 22 2C 0A 22 61 6C 70 68 61 62 65 74 69 "32",."alphabeti
> 00007F07682F27B0: 63 61 6C 53 6F 72 74 22 3A 20 74 72 75 65 2C 0A calSort": true,.
> 00007F07682F27C0: 22 69 74 65 6D 73 22 3A 20 5B 0A 7B 0A 22 69 64 "items": [.{."id
> 00007F07682F27D0: 22 3A 20 22 54 45 53 54 49 44 34 22 2C 0A 22 63 ": "TESTID4",."c
> 00007F07682F27E0: 72 65 61 74 65 64 42 79 22 3A 20 22 66 34 38 37 reatedBy": "f487
> 00007F07682F27F0: 35 30 35 32 22 2C 0A 22 63 72 65 61 74 65 64 41 5052",."createdA
> 00007F07682F2800: 74 22 3A 20 22 32 30 32 31 2D 31 31 2D 30 34 54 t": "2021-11-04T
> 00007F07682F2810: 31 34 3A 31 35 3A 32 32 5A 22 2C 0A 22 6C 61 73 14:15:22Z",."las
> 00007F07682F2820: 74 55 70 64 61 74 65 64 42 79 22 3A 20 22 66 34 tUpdatedBy": "f4
> 00007F07682F2830: 38 37 35 30 35 32 22 2C 0A 22 6C 61 73 74 55 70 875052",."lastUp
> 00007F07682F2840: 64 61 74 65 64 41 74 22 3A 20 22 32 30 32 31 2D datedAt": "2021-
> 00007F07682F2850: 31 31 2D 30 34 54 31 34 3A 31 35 3A 32 32 5A 22 11-04T14:15:22Z"
> 00007F07682F2860: 2C 0A 22 6C 61 62 65 6C 22 3A 20 22 4C 41 42 45 ,."label": "LABE
> 00007F07682F2870: 4C 2D 43 22 2C 0A 22 64 65 73 63 72 69 70 74 69 L-C",."descripti
> 00007F07682F2880: 6F 6E 22 3A 20 22 44 45 53 43 52 49 50 54 49 4F on": "DESCRIPTIO
> 00007F07682F2890: 4E 2D 41 22 2C 0A 22 6C 6F 63 61 6C 69 7A 65 64 N-A",."localized
> 00007F07682F28A0: 4C 61 62 65 6C 73 22 3A 20 5B 0A 7B 0A 22 69 64 Labels": [.{."id
> 00007F07682F28B0: 22 3A 20 22 54 45 53 54 49 44 35 22 2C 0A 22 63 ": "TESTID5",."c
> 00007F07682F28C0: 72 65 61 74 65 64 42 79 22 3A 20 22 66 34 38 37 reatedBy": "f487
> 00007F07682F28D0: 35 30 35 32 22 2C 0A 22 63 72 65 61 74 65 64 41 5052",."createdA
> 00007F07682F28E0: 74 22 3A 20 22 32 30 32 31 2D 31 31 2D 30 34 54 t": "2021-11-04T
> 00007F07682F28F0: 31 34 3A 31 35 3A 32 32 5A 22 2C 0A 22 6C 61 73 14:15:22Z",."las
> 00007F07682F2900: 74 55 70 64 61 74 65 64 42 79 22 3A 20 22 66 34 tUpdatedBy": "f4
> 00007F07682F2910: 38 37 35 30 35 32 22 2C 0A 22 6C 61 73 74 55 70 875052",."lastUp
> 00007F07682F2920: 64 61 74 65 64 41 74 22 3A 20 22 32 30 32 31 2D datedAt": "2021-
> 00007F07682F2930: 31 31 2D 30 34 54 31 34 3A 31 35 3A 32 32 5A 22 11-04T14:15:22Z"
> 00007F07682F2940: 2C 0A 22 76 65 72 73 69 6F 6E 22 3A 20 30 2C 0A ,."version": 0,.
> 00007F07682F2950: 22 6C 6F 63 61 6C 65 22 3A 20 22 65 6E 2D 55 53 "locale": "en-US
> 00007F07682F2960: 22 2C 0A 22 6C 61 62 65 6C 22 3A 20 22 4C 41 42 ",."label": "LAB
> 00007F07682F2970: 45 4C 2D 44 22 0A 7D 0A 5D 2C 0A 22 6C 6F 63 61 EL-D".}.],."loca
> 00007F07682F2980: 6C 69 7A 65 64 44 65 73 63 72 69 70 74 69 6F 6E lizedDescription
> 00007F07682F2990: 73 22 3A 20 5B 0A 7B 0A 22 69 64 22 3A 20 22 54 s": [.{."id": "T
> 00007F07682F29A0: 45 53 54 49 44 36 22 2C 0A 22 63 72 65 61 74 65 ESTID6",."create
> 00007F07682F29B0: 64 42 79 22 3A 20 22 66 34 38 37 35 30 35 32 22 dBy": "f4875052"
> 00007F07682F29C0: 2C 0A 22 63 72 65 61 74 65 64 41 74 22 3A 20 22 ,."createdAt": "
> 00007F07682F29D0: 32 30 32 31 2D 31 31 2D 30 34 54 31 34 3A 31 35 2021-11-04T14:15
> 00007F07682F29E0: 3A 32 32 5A 22 2C 0A 22 6C 61 73 74 55 70 64 61 :22Z",."lastUpda
> 00007F07682F29F0: 74 65 64 42 79 22 3A 20 22 66 34 38 37 35 30 35 tedBy": "f487505
> 00007F07682F2A00: 32 22 2C 0A 22 6C 61 73 74 55 70 64 61 74 65 64 2",."lastUpdated
> 00007F07682F2A10: 41 74 22 3A 20 22 32 30 32 31 2D 31 31 2D 30 34 At": "2021-11-04
> 00007F07682F2A20: 54 31 34 3A 31 35 3A 32 32 5A 22 2C 0A 22 76 65 T14:15:22Z",."ve
> 00007F07682F2A30: 72 73 69 6F 6E 22 3A 20 30 2C 0A 22 6C 6F 63 61 rsion": 0,."loca
> 00007F07682F2A40: 6C 65 22 3A 20 22 65 6E 2D 55 53 22 2C 0A 22 64 le": "en-US",."d
> 00007F07682F2A50: 65 73 63 72 69 70 74 69 6F 6E 22 3A 20 22 44 45 escription": "DE
> 00007F07682F2A60: 53 43 52 49 50 54 49 4F 4E 2D 42 22 0A 7D 0A 5D SCRIPTION-B".}.]
> 00007F07682F2A70: 2C 0A 22 63 6F 64 65 22 3A 20 22 43 4F 44 45 31 ,."code": "CODE1
> 00007F07682F2A80: 22 2C 0A 22 61 72 63 68 69 76 65 64 22 3A 20 74 ",."archived": t
> 00007F07682F2A90: 72 75 65 2C 0A 22 64 69 73 70 6C 61 79 49 6E 64 rue,."displayInd
> 00007F07682F2AA0: 65 78 22 3A 20 30 0A 7D 0A 5D 0A 7D 0A ex": 0.}.].}.
< HTTP/1.1 400
< Date: Thu, 04 Nov 2021 16:46:56 GMT
< Server: Apache/2.4
< Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' *.sas.com blob:
data:; style-src 'self' 'unsafe-inline'; child-src 'self' blob: data: mailto:;
< Cache-Control: no-cache, no-store, max-age=0, must-revalidate
< Pragma: no-cache
< Expires: 0
< Strict-Transport-Security: max-age=31536000 ; includeSubDomains
< X-Frame-Options: SAMEORIGIN
< Content-Type: application/json;charset=UTF-8
< X-Content-Type-Options: nosniff
< X-XSS-Protection: 1; mode=block
< Vary: User-Agent
< Connection: close
< Transfer-Encoding: chunked
<
< 00007F07682F2747: 7B 22 68 74 74 70 53 74 61 74 75 73 43 6F 64 65 {"httpStatusCode
< 00007F07682F2757: 22 3A 34 30 30 2C 22 65 72 72 6F 72 43 6F 64 65 ":400,"errorCode
< 00007F07682F2767: 22 3A 22 44 48 39 30 33 32 22 2C 22 6D 65 73 73 ":"DH9032","mess
< 00007F07682F2777: 61 67 65 22 3A 22 54 68 65 20 72 65 71 75 65 73 age":"The reques
< 00007F07682F2787: 74 20 69 73 20 6D 61 6C 66 6F 72 6D 65 64 22 2C t is malformed",
< 00007F07682F2797: 22 76 65 72 73 69 6F 6E 22 3A 31 7D "version":1}
NOTE: PROCEDURE HTTP used (Total process time):
real time 0.06 seconds
cpu time 0.03 seconds

101
102 data _null_;
103 infile sfile_r;
104 input;
105 put _infile_;
106 run;
NOTE: The infile SFILE_R is:
Filename=/saswork/work/SAS_work797400004390_frm-rbviesmpp/samplefile.resp,
Owner Name=f4875052,Group Name=unix-f4875052,
Access Permission=-rw-r--r--,
Last Modified=04Nov2021:18:46:56,
File Size (bytes)=92
{"httpStatusCode":400,"errorCode":"DH9032","message":"The request is malformed","version":1}
NOTE: 1 record was read from the infile SFILE_R.
The minimum record length was 92.
The maximum record length was 92.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds

107
108
109 %studio_hide_wrapper;
120
121

1 ACCEPTED SOLUTION

Accepted Solutions
gwootton
SAS Super FREQ

I think a lot of the stuff you're sending would be generated by the system, like "createdBy", "createdAt", "id", etc.

From the schema I think you'd need to supply only name, archived, maxCodeLength, alphabeticalSort, and then the items. The items similarly would be just code, archived and displayIndex.

https://developer.sas.com/apis/vi/rest/VisualInvestigator/#tocS_reference.list

 

{
  "name": "demoreflist",
  "archived": true,
  "maxCodeLength": "32",
  "alphabeticalSort": true,
  "items": [
    {
      "code": "code-1",
      "archived": true,
      "displayIndex": 0
    }
  ]
}
--
Greg Wootton | Principal Systems Technical Support Engineer

View solution in original post

5 REPLIES 5
gwootton
SAS Super FREQ

I think a lot of the stuff you're sending would be generated by the system, like "createdBy", "createdAt", "id", etc.

From the schema I think you'd need to supply only name, archived, maxCodeLength, alphabeticalSort, and then the items. The items similarly would be just code, archived and displayIndex.

https://developer.sas.com/apis/vi/rest/VisualInvestigator/#tocS_reference.list

 

{
  "name": "demoreflist",
  "archived": true,
  "maxCodeLength": "32",
  "alphabeticalSort": true,
  "items": [
    {
      "code": "code-1",
      "archived": true,
      "displayIndex": 0
    }
  ]
}
--
Greg Wootton | Principal Systems Technical Support Engineer
brendanb
Obsidian | Level 7
Hi, i see the list but there are no items. I am not getting an error, so not sure why the item is not added to the list. Also, do you perhaps have a simple hierarchy example. Many thanks,
gwootton
SAS Super FREQ

Do you mean if you then call the newly created listing's endpoint the item(s) in the request aren't present? i.e. /svi-datahub/admin/lists?name=demoreflist

 

Or they just aren't visible in the UI? Here's an example of multiple listings for Size.

 

{
  "name": "Size",
  "archived": true,
  "maxCodeLength": "32",
  "alphabeticalSort": false,
  "items": [
    {
      "code": "Small",
      "archived": true,
      "displayIndex": 0
    },
    {
      "code": "Medium",
      "archived": true,
      "displayIndex": 1
    },
    {
      "code": "Large",
      "archived": true,
      "displayIndex": 2
    }
  ]
}
--
Greg Wootton | Principal Systems Technical Support Engineer
brendanb
Obsidian | Level 7

thank you, as you asked, not available on the UI but available when I run api get. I also don't see a reference value (description), only a code from the API call.

gwootton
SAS Super FREQ

Does changing the "archived" value to false have any bearing on the visibility of the items? You can change an existing list using a PUT call against /admin/lists/<id>.

--
Greg Wootton | Principal Systems Technical Support Engineer

sas-innovate-white.png

Missed SAS Innovate in Orlando?

Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.

 

Register now

Discussion stats
  • 5 replies
  • 2425 views
  • 1 like
  • 2 in conversation