GithubHelp home page GithubHelp logo

isabella232 / microsoft-graph-devx-content Goto Github PK

View Code? Open in Web Editor NEW

This project forked from microsoftgraph/microsoft-graph-devx-content

0.0 0.0 0.0 2.16 MB

Content used by the DevX API to enhance clients and tooling.

License: MIT License

JavaScript 100.00%

microsoft-graph-devx-content's Introduction

microsoft-graph-devx-content

Content used by the DevX API to enhance clients and tooling. At the moment it has:

  • Permissions
  • Samples

This will also be used by the localization team to add translation files, and by feature teams to modify, add, or update samples.

Contributing

1. Sample Queries

Pre-requisites:

  1. Download and Install Git to your machine https://git-scm.com/downloads
  2. Download and Install VS Code to your machine https://code.visualstudio.com/download

To add sample queries follow these steps:

  1. Clone or fork this repo (microsoft-graph-devx-content) in your local machine.
  2. Navigate to the file sample-queries.json in the sample-queries folder.
  3. Open the file sample-queries.json on your favourite editor (e.g VS Code)
  4. If you are adding a new category (workload) sample (e.g. Teams, Excel), add the queries at the end of the list right before the closing square bracket ] in the following format. However, if you are adding a sample query to an existing category, find it on the document and add the query next to the other queries in that category.
    GET example
 {
  "id": "76ecc500-897d-4a5e-a15c-0f6702a43d32",
  "category": "Extensions",
  "method": "GET",
  "humanName": "get available schema extensions",
  "requestUrl": "/v1.0/schemaExtensions",
  "docLink": "https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/schemaextension_post_schemaextensions",
   "skipTest": false
  },
  • id - generate a GUID here: https://guidgenerator.com/
  • category - the workload category the sample query falls under e.g. Teams, Outlook, Extensions etc
  • method - request option, e.g GET, POST, PUT, PATCH, DELETE
  • humanName - the name users will see on Graph Explorer UI describing what the sample query does
  • requestUrl - the url to query the sample query on Graph API, but dont put the https://graph.microsoft.com bit of the url
  • docLink - link to the sample query documentation.
  • skipTest - this is always false for all sample queries

POST Example includes headers, post body and a tip

{
"id": "9b937d40-885d-4eb1-a36d-9b001ce63d1d",
"category": "OneNote",
"method": "POST",
"humanName": "create section",
"requestUrl": "/v1.0/me/onenote/notebooks/{notebook-id}/sections",
"docLink": "https://developer.microsoft.com/en-us/graph/docs/api-reference/v1.0/api/notebook_post_sections",
"headers": [
{
"name": "Content-type",
"value": "application/json"
}
],
"postBody": "{\r\n \"displayName\": \"Section 1\"\r\n}",
"tip": "This query requires a notebook id. To find the ID, you can run: GET https://graph.microsoft.com/v1.0/me/onenote/notebooks. ",
"skipTest": false<br> },

  • headers - add the headers required to run the POST query
  • postBody - add the post body required to run the query
  • tip - include a tip giving more information to the user on things like permissions required, and how to get an id if needed.

When done making the changes on the document,

  1. Save the document on your machine
  2. Create a Git branch on this repo and name it using your initials + describe the changes ie. bn/add-xyz-samples
  3. Commit the changes to your branch
  4. Create a PR and add Bettirose Ngugi and/or Irvine Sunday as the reviewer(s).

Once the PR is reviewed and merged, the changes will appear on Graph Explorer in 2 working days.

Please note that:

  1. The order of properties is as outlined below (where applicable for your sample)
    "id":
    "category":
    "method":
    "humanName":
    "requestUrl":
    "docLink":
    "headers":
    "postBody":
    "tip":
    "skipTest":
  2. The humanName value should be in small caps only.
  3. The requestUrl value should be a relative url, starting from the version, i.e. "requestUrl": "/v1.0/me/onenote/notebooks/{notebook-id}/sections" leave out the https://graph.microsoft.com part of the url.

Using Command Line or PowerShell:

1. Clone or Fork the repo

In your command line or shell, paste this command to clone or fork this repo:
git clone https://github.com/microsoftgraph/microsoft-graph-devx-content.git microsoft-graph-devx-content cd microsoft-graph-devx-content/sample-queries

2. Open the sample-queries.json file

To open the sample-queries.json file, paste in this command:
code -n sample-queries.json

Alternatively, you can open the directory where the file is located by pasting in this command:
start .

3. Open the Git command utility

If your machine's OS/CPU is x64, paste in this command:
start "" "%PROGRAMFILES%\Git\bin\sh.exe" --login else, if x86, paste in this command:
start "" "%SYSTEMDRIVE%\Program Files (x86)\Git\bin\sh.exe"

4. Create your local branch

Your branch name has to be of the format: {your-intial}/{purpose-of-change}. Replace the text within the curly braces (inclusive of the curly braces).
Then in the new Git command line window, paste in this command to create and checkout your branch:
git checkout -b {your-branch-name}

5. Update your sample query

Now you can add, update or delete your sample query in the sample-queries.json file that opened up in VS Code earlier.

6. Add, commit and push your changes back to the remote repo with the following commands

  • Add the changes to you local repo: git add sample-queries.json
  • Commit your changes: git commit -m "{add-reason-for-update}"
  • Push your changes to the remote repo: git push origin {your-branch-name}

7. Login to GitHub

Follow the instructions to login to GitHub using your credentials.

8. If you get error 403

Follow the instructions specified, then run this command again:
git push origin {your-branch-name}

If you run into any issues, reach out to @BettiroseNgugi

microsoft-graph-devx-content's People

Contributors

bettirosengugi avatar content-assistant[bot] avatar iamqinmu avatar irvinesunday avatar japere avatar lanhongvp avatar licantrop0 avatar luleonpla avatar maggiekimani1 avatar mahage-msft avatar michaelmainer avatar neelkshah avatar nkramer avatar olprod avatar thewahome avatar videor avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.