Skip to main content

Posts

Showing posts with the label restAPI

How to use Azure DevOps REST API to extract and update data within Azure DevOps?

Azure DevOps offers a fantastic set of REST APIs which allows you to extract and operate data within Azure DevOps by sending an HTTP request to a specific service. It is up to you how you want to call these APIs i.e., using Postman if you are not a fan of coding much or you can use RestAssured, RestSharp libraries if you can write code. I am using Postman here to execute these APIs; all the Azure DevOps Rest APIs expect you to follow these things: 1)    Provide the PAT (Personal Access Token) in the Authorization  tab: o   Type : Basic Auth o   Username : leave it blank o   Password : Enter your PAT Note* Here is how you can create a PAT: https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows#create-personal-access-tokens-to-authenticate-access 2)     Send the request o Select the HTTP Method (Get, Post, Patch, etc.) o Create a request URL, replacing your organization and your project name of yo

AWS Signature with RestAssured

  AWS Signature authentication support is not something that is available in RestAssured as out-of-box feature. At least I wasn't able to find any good documentation for the same. So, how we can implement AWS Signature Headers with Rest Assured? Signing AWS requests with Signature Version 4... This explains step by step how to create a signature and add it to an HTTP request to AWS: https://docs.aws.amazon.com/general/latest/gr/sigv4_signing.html Below given source code (AWSV4Auth.java) helps to calculate signature based on given data and return the headers. Once you get headers suing aWSV4Auth.getHeaders(), you just need to add these headers in your Rest API call (Sample for the same is given below: RATest.java) AWSV4Auth.java: public class AWSV4Auth {     private AWSV4Auth() {     }     public static class Builder {         private String accessKeyID;         private String secretAccessKey;         private String regionName;         private String serviceName;         private Str

JSON Server: Rest API

I get that a lot that there are so many folks especially college students who struggle to find Rest APIs where they can play not only with the GET but with POST, PUT, DELETE methods too. The JSON Server is a popular and handy tool that lets you play with the mock REST APIs. It helps you to set up a REST API with CRUD operations very fast. Please go through this link to know more about it: https://github.com/typicode/json-server From set-up >> installation >> usage- everything is so simple. I recommend to use it along with the faker library to make it more effective: https://github.com/Marak/faker.js , like by creating a js file to inject the fake data: module.exports = () => { var faker = require("faker"); const data = { users: [] } // Create 50 users for (let i = 0; i < 50; i++) { data.users.push({ id: i, name: faker.name.findName(),email:faker.internet.email(), zipCode: faker.address.zipCode()}) } return data } Here's th