• Programming,  Web Development

    HTTP Success and Error Codes

    When you make a request to a web server, the server will respond with a status code. The status code indicates whether the request was successful or not, and if not, what the error was. There are lots of different HTTP response codes, which are three digit codes that generally align with the following classes: Of these, some of the most common ones we run into include the following: HTTP response codes are typically more used by web developers (and web browser developers) to bettter understand the status of a request and to take appropriate action. For example, if a request returns a 404 Not Found status code, the web…

  • Web Development

    Obtain a bearer token using curl

    In the following, we set a variable called BearerToken using a simple curl to the contents of a bearer token. We do so by running a curl with data in the header for “userid” although sometimes we see this as just “user” or “username” and then a password. This hits an endpoint called authenticationendpoint although sometimes we see that called “auth” or “authenticate” – in this specific case we’re pulling the bearer token out of “id” and it’s nested in there with a name of “token”: BearerToken=$(curl -s -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' --data '{"userid”:”{userid}”,”password":"{password}"}' https://krypted.com//api/authenticationendpoint | sed -E 's/\},\s*\{/\},\n\{/g' File | grep  ‘”id” : “token”’) Once…