112
112
"description" : " Gets the notebooks for a list of onenote weburls"
113
113
},
114
114
"response" : []
115
+ },
116
+ {
117
+ "name" : " CreateNewNotebook" ,
118
+ "request" : {
119
+ "method" : " GET" ,
120
+ "header" : [],
121
+ "body" : {
122
+ "mode" : " raw" ,
123
+ "raw" : " "
124
+ },
125
+ "url" : {
126
+ "raw" : " "
127
+ }
128
+ },
129
+ "response" : []
115
130
}
116
131
],
117
132
"description" : " All available POST actions in Notebooks API" ,
653
668
"bearer" : [
654
669
{
655
670
"key" : " token" ,
656
- "value" : " {{AuthToken}}" ,
671
+ "value" : " {{{{ AuthToken}} }}" ,
657
672
"type" : " string"
658
673
}
659
674
]
665
680
"id" : " 4fcc87ca-73a0-4014-93cd-88c9089ecd59" ,
666
681
"type" : " text/javascript" ,
667
682
"exec" : [
668
- " "
683
+ " const AuthTokenName = \" AuthToken\" ;" ,
684
+ " const AuthTokenExpName = \" AuthTokenExp\" ;" ,
685
+ " const AuthTokenUrlName = \" AuthTokenUrl\" ;" ,
686
+ " const ClientIdName = \" ClientId\" ;" ,
687
+ " const passwordName = \" password\" ;" ,
688
+ " const usernameName = \" username\" ;" ,
689
+ " const resource = \" https://officeapps.live.com\" ;" ,
690
+ " const scope = \" openid\" ;" ,
691
+ " " ,
692
+ " // Object used to request an authtoken" ,
693
+ " // Based on currently selected postman environment" ,
694
+ " const echoPostRequest = {" ,
695
+ " url:getGlobalVarThroughEnvironmentVar(AuthTokenUrlName)," ,
696
+ " method: 'POST'," ,
697
+ " body: {" ,
698
+ " mode: 'urlencoded'," ,
699
+ " urlencoded: [" ,
700
+ " { key: \" grant_type\" , value: \" password\" }," ,
701
+ " { key: \" username\" , value: getGlobalVarThroughEnvironmentVar(usernameName)}," ,
702
+ " { key: \" password\" , value: getGlobalVarThroughEnvironmentVar(passwordName) }," ,
703
+ " { key: \" resource\" , value: resource }," ,
704
+ " { key: \" scope\" , value: scope }," ,
705
+ " { key: \" client_id\" , value: getGlobalVarThroughEnvironmentVar(ClientIdName)}" ,
706
+ " ]" ,
707
+ " }" ,
708
+ " }" ,
709
+ " " ,
710
+ " // Verify if the AuthToken needs to be refreshed" ,
711
+ " if (!getGlobalVarThroughEnvironmentVar(AuthTokenName) || " ,
712
+ " !getGlobalVarThroughEnvironmentVar(AuthTokenExpName)) {" ,
713
+ " console.log('AuthToken or expiry date are missing')" ,
714
+ " requestAuthToken();" ,
715
+ " }" ,
716
+ " else if (getGlobalVarThroughEnvironmentVar(AuthTokenExpName) <= (new Date()).getTime()) {" ,
717
+ " console.log('AuthToken is expired')" ,
718
+ " requestAuthToken();" ,
719
+ " }" ,
720
+ " else {" ,
721
+ " console.log(\" Current AuthToken is still valid.\" );" ,
722
+ " }" ,
723
+ " " ,
724
+ " // Makes a request to bet a new AuthToken." ,
725
+ " // This will store the new auth token as a global variable." ,
726
+ " function requestAuthToken (){" ,
727
+ " pm.sendRequest(echoPostRequest, function (err, res) {" ,
728
+ " console.log(err ? err : res.json());" ,
729
+ " if (err === null) {" ,
730
+ " console.log('Saving the token and expiry date')" ,
731
+ " var responseJson = res.json();" ,
732
+ " setGlobalVarThroughEnvironmentVar(AuthTokenName, responseJson.access_token)" ,
733
+ " " ,
734
+ " var expiryDate = new Date();" ,
735
+ " expiryDate.setSeconds(expiryDate.getSeconds() + responseJson.expires_in);" ,
736
+ " setGlobalVarThroughEnvironmentVar(AuthTokenExpName, expiryDate.getTime());" ,
737
+ " }" ,
738
+ " });" ,
739
+ " }" ,
740
+ " " ,
741
+ " // Using an env variable to grab the global variable allows us to avoid checking for what env we are running on here. Instead we rely on postman's current env selection to search for the right global variable. See how globals are setup (they are basically a collection of both prod and ppe environment variables that are selected based on the env we are running)" ,
742
+ " function getGlobalVarThroughEnvironmentVar(varName){" ,
743
+ " return pm.globals.get(pm.environment.get(varName));" ,
744
+ " }" ,
745
+ " " ,
746
+ " function setGlobalVarThroughEnvironmentVar(varName, value){" ,
747
+ " return pm.globals.set(pm.environment.get(varName),value);" ,
748
+ " }"
669
749
]
670
750
}
671
751
},
682
762
],
683
763
"variable" : [
684
764
{
685
- "id" : " 27dd41e1-9eb4-4bd1-a6b3-5951fe5c3c5b " ,
765
+ "id" : " 944ea569-9ccb-4142-bafe-1f91d21966ec " ,
686
766
"key" : " AppIdHeader" ,
687
767
"value" : " MS-Int-AppId" ,
688
768
"type" : " string"
689
769
},
690
770
{
691
- "id" : " bab30ef8-d149-4035-91cc-805066188bbd " ,
771
+ "id" : " a5c1724e-4999-43ed-b313-903cca95072a " ,
692
772
"key" : " AppIdHeader_Value" ,
693
773
"value" : " Testing" ,
694
774
"type" : " string"
695
775
},
696
776
{
697
- "id" : " 83cd5418-04cc-4599-96c1-ba5782fee84f " ,
777
+ "id" : " 4974d457-4da1-41a5-af81-1831e596c16c " ,
698
778
"key" : " Me" ,
699
779
"value" : " {{Site}}/api/{{version}}/me" ,
700
780
"type" : " string"
701
781
},
702
782
{
703
- "id" : " a5448c9f-6feb-4f28-a863-d2fa62bf1f0e " ,
783
+ "id" : " 98d97588-53a7-47df-a421-2540f3392088 " ,
704
784
"key" : " MeNotebooks" ,
705
785
"value" : " {{Me}}/notes/notebooks" ,
706
786
"type" : " string"
707
787
},
708
788
{
709
- "id" : " 09cb72f3-8378-4e8c-99ea-9e9a48b68d18 " ,
789
+ "id" : " 8a38cd0e-1221-4e30-bc41-4bdb76007981 " ,
710
790
"key" : " User" ,
711
791
"value" : " {{Site}}/api/{{version}}/users('{{UserId}}')" ,
712
792
"type" : " string"
713
793
},
714
794
{
715
- "id" : " 3416584c-a122-46ff-adc2-118374d34d18 " ,
795
+ "id" : " a84f3e15-d116-4895-8473-1dfb4af2c1f9 " ,
716
796
"key" : " UserNotebooks" ,
717
797
"value" : " {{User}}/notes/notebooks" ,
718
798
"type" : " string"
719
799
},
720
800
{
721
- "id" : " e4df61fa-296c-46b2-9c98-df0c2a4d0756 " ,
801
+ "id" : " 833b68bc-877e-4431-af63-063cb61a058b " ,
722
802
"key" : " MeClassNotebooks" ,
723
803
"value" : " {{Me}}/notes/classnotebooks" ,
724
804
"type" : " string"
725
805
},
726
806
{
727
- "id" : " 261df2b5-5218-4c35-9790-c60360a3c8bd " ,
807
+ "id" : " de23dabd-833f-45e0-acaf-a53a5052736d " ,
728
808
"key" : " MeSections" ,
729
809
"value" : " {{Me}}/notes/sections" ,
730
810
"type" : " string"
731
811
},
732
812
{
733
- "id" : " 749901cd-60f9-4a51-b6a3-ad5f2064fdc4 " ,
813
+ "id" : " 46e64f47-3f5b-4c0c-a02f-9165393e5f07 " ,
734
814
"key" : " MeSectionGroups" ,
735
815
"value" : " {{Me}}/notes/sectiongroups" ,
736
816
"type" : " string"
737
817
},
738
818
{
739
- "id" : " 2c478448-f0da-4e04-bfa5-e6c3d20b0764 " ,
819
+ "id" : " 47ac2929-6a60-48df-89fb-a9b5ef8477c6 " ,
740
820
"key" : " MeResources" ,
741
821
"value" : " {{Me}}/notes/resources" ,
742
822
"type" : " string"
743
823
},
744
824
{
745
- "id" : " 0e5ccb28-79ae-49a8-bdda-4ff7228de9bd " ,
825
+ "id" : " c97bf9e3-e619-4041-b05d-68e39c29e730 " ,
746
826
"key" : " WopiHost" ,
747
827
"value" : " {{Site}}/host" ,
748
828
"type" : " string"
749
829
},
750
830
{
751
- "id" : " 07cc0245-c2d0-41df-aad5-400013bc496f " ,
831
+ "id" : " 292036fb-4115-4346-b358-d2ed84285c68 " ,
752
832
"key" : " WOPIEndpoint" ,
753
833
"value" : " {{Site}}/sync/{{WOPIVersion}}/Wopi" ,
754
834
"type" : " string"
755
835
},
756
836
{
757
- "id" : " 35e4cac5-5820-4e45-88dc-94daecdc4c1c " ,
837
+ "id" : " ce78324b-56f2-4721-bbae-ecf20b252ff3 " ,
758
838
"key" : " MePages" ,
759
839
"value" : " {{Me}}/notes/pages" ,
760
840
"type" : " string"
761
841
},
762
842
{
763
- "id" : " e950e3fd-449d-4b76-bedf-6a4fafceed10 " ,
843
+ "id" : " ee2c2a0f-1a8d-4c3e-82a5-a86161dde602 " ,
764
844
"key" : " Target_Body" ,
765
845
"value" : " body" ,
766
846
"type" : " string"
767
847
},
768
848
{
769
- "id" : " cb458a39-1623-4638-805d-20bb6a14e1d2 " ,
849
+ "id" : " e003e729-3bfe-4eca-8e9d-886e06b237b8 " ,
770
850
"key" : " UserId" ,
771
851
"value" : " <Update current value only, leave this initial value as is>" ,
772
852
"type" : " string"
773
853
},
774
854
{
775
- "id" : " f4fb182b-6464-4825-b475-d8d83025b594 " ,
855
+ "id" : " 2b6cd8eb-e3d4-4eef-ae3b-3d8dcd253b88 " ,
776
856
"key" : " PageId" ,
777
857
"value" : " <Update current value only, leave this initial value as is>" ,
778
858
"type" : " string"
779
859
},
780
860
{
781
- "id" : " a282b197-5e2c-4f27-8d68-d5bdeec7b2c6 " ,
861
+ "id" : " b047d47d-c99a-44c5-935d-971b9a5fb87a " ,
782
862
"key" : " SectionId" ,
783
863
"value" : " <Update current value only, leave this initial value as is>" ,
784
864
"type" : " string"
785
865
},
786
866
{
787
- "id" : " 19011c28-0885-4481-b966-e7e043304cce " ,
867
+ "id" : " 9ee943e5-60a1-44a5-a0c8-aafa8de86a27 " ,
788
868
"key" : " SectionGroupId" ,
789
869
"value" : " <Update current value only, leave this initial value as is>" ,
790
870
"type" : " string"
791
871
},
792
872
{
793
- "id" : " 0dde8fa3-7db3-49f9-ad00-2b0746ab113a " ,
873
+ "id" : " 97b5fc7d-886c-4bbb-a00e-052c08cf92d4 " ,
794
874
"key" : " NotebookId" ,
795
875
"value" : " <Update current value only, leave this initial value as is>" ,
796
876
"type" : " string"
797
877
},
798
878
{
799
- "id" : " 295ad84f-8345-459d-83b5-52dc28cb6b4c " ,
879
+ "id" : " 4c8bb370-0c98-4dad-9781-fe46b8626e12 " ,
800
880
"key" : " ResourceId" ,
801
881
"value" : " <Update current value only, leave this initial value as is>" ,
802
882
"type" : " string"
803
883
},
804
884
{
805
- "id" : " c66ce02b-d97d-49ec-a707-fdf3b7711220 " ,
885
+ "id" : " 9c29be8a-392d-444b-9207-6b02d6ff120c " ,
806
886
"key" : " MachineName" ,
807
887
"value" : " <Update current value only, leave this initial value as is>" ,
808
888
"type" : " string"
809
889
},
810
890
{
811
- "id" : " e0df9ae4-0840-41ec-8397-e9a9a59d953d " ,
891
+ "id" : " 8e81cc0a-8361-415f-877e-da7185c1037c " ,
812
892
"key" : " WebUrl" ,
813
893
"value" : " <Update current value only, leave this initial value as is>" ,
814
894
"type" : " string"
815
895
},
816
896
{
817
- "id" : " 144bc424-902e-474f-b239-0ac931dae5a1 " ,
897
+ "id" : " 2837b63e-520d-478c-a736-737ccb26f2ea " ,
818
898
"key" : " WebUrls" ,
819
899
"value" : " <Update current value only, leave this initial value as is>" ,
820
900
"type" : " string"
821
901
},
822
902
{
823
- "id" : " d88b074f-b159-42c7-a904-b6e3fd351639 " ,
903
+ "id" : " 95dd85aa-9856-49f5-9a65-3942dd5b30f1 " ,
824
904
"key" : " Target_Id" ,
825
905
"value" : " <Update current value only, leave this initial value as is>" ,
826
906
"type" : " string"
827
907
},
828
908
{
829
- "id" : " 1304283e-6fb6-4f28-ad6e-20009dc50a18 " ,
909
+ "id" : " 35c8ad64-c57d-4459-b84e-a99e7e630ba6 " ,
830
910
"key" : " HTMLContent" ,
831
911
"value" : " <Update current value only, leave this initial value as is>" ,
832
912
"type" : " string"
833
913
},
834
914
{
835
- "id" : " 38061292-d589-4b22-b97d-e9874e1eb410 " ,
915
+ "id" : " d24a5daa-1561-4583-8905-82ca4bb0df26 " ,
836
916
"key" : " Test_Title" ,
837
917
"value" : " <Update current value only, leave this initial value as is>" ,
838
918
"type" : " string"
839
919
},
840
920
{
841
- "id" : " ff04f9cb-d831-4f7e-904a-45e2dbf05016 " ,
921
+ "id" : " 38a5a4e4-c6aa-458a-9e08-35ae790e81ce " ,
842
922
"key" : " Test_JapaneseTitle" ,
843
923
"value" : " <Update current value only, leave this initial value as is>" ,
844
924
"type" : " string"
925
+ },
926
+ {
927
+ "id" : " d6df31e0-8442-431f-a219-f37b76983e53" ,
928
+ "key" : " NotebookName" ,
929
+ "value" : " <Update current value only, leave this initial value as is>" ,
930
+ "type" : " string"
845
931
}
846
932
]
847
933
}
0 commit comments