Type : CREATION_INTERNE
Le corps de la requête HTTP (un fichier XML décrivant le terme BDN) est créé dynamiquement au sein du script SAS à l'aide d'un bloc `DATA _NULL_` et de l'instruction `PUT`.
| 1 | filename in "&root.create_term.xml"; |
| 2 | DATA _null_; |
| 3 | file in; |
| 4 | put '<term parentId="1000922" name="Expected Loss" type="DG" description="Created from SAS code: /*Post a term to BDN*/" |
| 5 | requirements="none" status="Editing" importance="Very Low" |
| 6 | CreatedByUser="sasdemo" ModifiedbyUser="sasdemo"></term>' ; |
| 7 | RUN ; |
| 1 | PROC HTTP |
| 2 | url="http://sasclient.race.sas.com/SASBusinessDataNetwork/rest/terms" method="POST" |
| 3 | webusername="sasdemo" |
| 4 | webpassword="&pass" |
| 5 | in=in /*the file that will be posted*/ |
| 6 | ct="application/xml;charset=UTF-8"; /*Important: explains if the content of the in file posted is a xml or json file*/ |
| 7 | RUN ; |
| 1 | %macro prochttp_check_return(code); |
| 2 | %IF %symexist(SYS_PROCHTTP_STATUS_CODE) ne 1 %THEN %DO; |
| 3 | %put ERROR: Expected &code., but a response was not received from |
| 4 | the HTTP Procedure; |
| 5 | %abort; |
| 6 | %END; |
| 7 | %ELSE %DO; |
| 8 | %IF &SYS_PROCHTTP_STATUS_CODE. ne &code. %THEN %DO; |
| 9 | %put ERROR: Expected &code., but received &SYS_PROCHTTP_STATUS_CODE. |
| 10 | &SYS_PROCHTTP_STATUS_PHRASE.; |
| 11 | %abort;%END; |
| 12 | %END; |
| 13 | %mend; |
| 1 | %prochttp_check_return(201); |
| 2 | QUIT; |