Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAP Developer Challenge - APIs - Task 0 - Learn to share your task results

qmacro
Developer Advocate
Developer Advocate

(Check out the SAP Developer Challenge - APIs blog post for everything you need to know about the challenge to which this task relates!)

This month's Developer Challenge consists of a number of tasks. Each task is introduced in a new, separate discussion thread on the SAP Community platform, specifically in the Application Development group.

Background

In each new discussion created, a new task will be presented. The context will be explained and relevant background information and pointers to helpful resources will be provided. But most importantly for you, the task itself will be described in detail, and that detail will include exactly the result that you need to produce.

That result will be in the form of a string, which you will then need to share in a reply to that task's discussion thread.

But.

Instead of sharing the result in its raw form, you'll first need to hash it with your SAP Community ID. This is for two reasons:

First, you can share your result but no-one can copy your answer, as it will be hashed with another value unique to you - your SAP Community ID. This means that you can share your hashed task result value openly but no-one can copy it and use it as their own.

Second, it's a good opportunity to interact with a simple API, providing data in the URL path, but also providing your SAP Community ID as a value in a special header in the HTTP request.

Hashing data is quite straightforward and there are libraries built into many programming languages to do this. It is not normally necessary to have to use an API call to use a hash function. We are just providing one here to give you some extra API work to do as part of this month's challenge!

Hashing your value

When you have a value which represents the result of a task, that you need to share, follow this procedure. For this example, let's say that the value is the string my-task-result.

Call the hash endpoint to get your hash

There's a simple HTTP service at https://developer-challenge.cfapps.eu10.hana.ondemand.com/ that currently provides a single endpoint /v1/hash. Use this endpoint as instructed to receive a hash. You must provide two pieces of information:

  • the value you want to hash (as part of the URL path)
  • your SAP Community ID (in a header)

How you specify each of these two values is described on the HTTP service's landing page. Make sure you follow the instructions.

If your call is successful, you'll receive a hash in response. The hash mechanism uses SHA256 and a hex digest is what's provided as the hash output, in case your interested.

Reply to the task's discussion thread with that hash

Once you have the hash, post a reply to the task's discussion thread, with that hash value.

DO NOT ADD ANYTHING ELSE TO THAT REPLY. Don't be tempted to add any formatting, either. Include just the hash value, with no other content. This is because we will be automating the checks for correct responses, and if we cannot successfully parse out the hash value from your reply, that value won't be counted.

Your task

So the very first task of this month's Developer Challenge ... is to make sure you can follow the above process to hash a value (representing any given answer to a future task in this series) and provide it in a reply to the discussion thread.

Use the static value

this-is-the-year-of-the-api

(don't include the line number 1 in there, that's just an artifact of how preformatted text is rendered on this platform) and follow the above process to get a hash for this value and post the hash as a reply to this discussion thread.

You can call the hash endpoint any way you like. Note that you can't just call it in your browser, as a basic GET request. In other words, you can't just make a simple HTTP GET request to https://developer-challenge.cfapps.eu10.hana.ondemand.com/v1/hash(value='this-is-the-year-of-the-api... and expect to get a successful hash response. You must provide an extra HTTP header in your request, conveying your SAP Community ID, as described in the landing page.

Hints and tips

You can make the API call to get a hash for your combination of value and SAP Community ID any way you wish.

Your favorite programming language

For example, you could use your favorite programming language. There'll be a library that will let you make HTTP requests, add custom headers, and capture the body of the response.

The REST Client extension

If you're comfortable in VS Code or the SAP Business Application Studio, you can use the REST Client extension (which is built-in to SAP Business Application Studio Dev Spaces). This extension lets you define HTTP requests, and run them. Here's an example of this in action:

rest-client.png

Using the REST Client extension to make the hash API call

Postman

You could also use a graphical HTTP client such as Postman.

postman.png

Using Postman to make the hash API call

A command line client

You can of course use a command line client, arguably the most flexible and powerful approaches. And after all, #TheFutureIsTerminal, right? There are many command line HTTP clients, such as wget, httpie and of course curl, which is used everywhere, even on Mars.

Here's an example using curl:

curl \
  --include \
  --header "CommunityID: qmacro" \
  --url "https://developer-challenge.cfapps.eu10.hana.ondemand.com/v1/hash(value='this-is-the-year-of-the-api')"

The response (which includes the HTTP headers in that response, because we asked for them with the --include option), looks like this:

HTTP/2 200
content-type: text/plain; charset=utf-8
date: Sat, 22 Jul 2023 13:53:34 GMT
etag: W/"40-LWwbQuJtCsQ3SBBXmdG8hHlJ0EI"
x-correlation-id: a718cf85-83a6-4d3a-54df-9791f1cea235
x-powered-by: Express
x-vcap-request-id: a718cf85-83a6-4d3a-54df-9791f1cea235
content-length: 64
strict-transport-security: max-age=31536000; includeSubDomains; preload;

b8193c6703e9d123e4aa639e43eee631a2f6e3788508b5c6fb3098a3f201607c

Sharing your hash in a reply to the discussion thread

In each of these examples, the hash received in response is:

b8193c6703e9d123e4aa639e43eee631a2f6e3788508b5c6fb3098a3f201607c

This is the value that must be posted in a reply to this discussion thread. Just copy-paste it into the body of a new reply.

248 REPLIES 248

dakoller
Discoverer
0 Kudos

6a885820c68ea675b02ac388d3457590d8b53c0c49fcca2630a25635e4dda3f0

fsteurer
Explorer
0 Kudos

ca73d406364f473f1eac769f0634d3e51c0fbe6b3a8901ac9afcfc6c6bb07f1b

jasshauer
Explorer
0 Kudos

20335ca739b49a822f5ef206d1601ad69bf40cf9eb6cd418f9de70aba14ce1ed

lvhengel
Participant
0 Kudos

0628d02d5656ca96bc050d6e5e4c85896e6dc82dd0dea12e32d082fc97b132fa

Mahmoud-Farag
Participant
0 Kudos

5bddcbff915a27743abb35c7587adba7e3fd21e721dffb22d5fa8df9d475ac51

xyla
Participant
0 Kudos

bb0f9b620afd7f1d45bf85118baa2049aa5ab16436527a10295eb587256db4e2

FooThePolarBear
Explorer
0 Kudos

994497f72a757ee17fb14afd4258ee96e06b16b794c1f7f1ca8cdb68dac6778b

SebastianSchuck
Active Participant
0 Kudos

37b519ebd0d3937f37670599154be988ac270f2b611a55d8d66bc2235b6de938

amine_b23
Newcomer
0 Kudos

9d0cfc19d7ae8803c196cd30bcc6d1b7e6bde56941c19dc5f406487a1436fa5c

Trulov
Participant
0 Kudos

d0faea85f832d46d998d52dfccb622b4fa8e6d2f10d611e279f3028f30548b8c

brahammittal
Explorer
0 Kudos

56fd04e32981d96f00751aa73661aa4389675e8e1075fae3ad6d8dad6f25ce51

nmkarthikeya
Active Participant
0 Kudos

b6e7c79f9c6309a10c2f52f1cd3be469430cb4558dd1bf068bfeb62dfa5e0494

d067595
Product and Topic Expert
Product and Topic Expert
0 Kudos

f251fc6272a614e68720d3f639bbec1ac69aed3d17dc30c320d34d7a8f652664

marhol
Product and Topic Expert
Product and Topic Expert
0 Kudos

56201956183e5f74b063ec2b6406315ffb6ccbfc41c0437774cd9b5f3821c89f

ajmaradiaga
Developer Advocate
Developer Advocate
0 Kudos

ea160a52dceb5e07725496c4188e36e281156983ffeb8290747a31a0c45213b6

emiliocampo
Explorer
0 Kudos

2759dd5179664141583c19541aee0e9b602f55d7a596007951c315119bc01ca9

fabio_correa
Newcomer
0 Kudos

ab3933c0ad0d38d0daabc3aaea662cbeed93549f201d7f7d03eb737ea44547e0

fenna
Explorer
0 Kudos

09c8fa893033b6b33accf5a97c8b98d504ed4024418801a2b28683fd1ebf95e9

harsh_itaverma
Participant
0 Kudos

0e50dd86e818777a9e5243b057d2fa8447caee1637f30dbaba85107901de706c

danielpobletaes
Discoverer
0 Kudos

0e5f3d95ca1b217559097fac061bed1cf1c6aff10c79b2a228f3af3f0e71be65

bztoy
Participant
0 Kudos

da69245ef57b3e53508f42933075cec4e6d4222e019e826a20890525a9678f6e

jmalappil
Discoverer
0 Kudos

164bfd7f2fda65127b563404e3ecfce1de06bb137c6fddbe1d9accd9ffe55245

mvaibhav
Contributor
0 Kudos

b9bff541de6a7a3875608a8da4651a3174a69efdd662250b304b3a3cc02ab0db

BrijeshGandhi
Explorer
0 Kudos

b1cb69bf4234fe8d8c92ad2459e6ec92d51e1ea5aa4fff53fb301ef5dd104253

martin_zauner
Discoverer
0 Kudos

9966d7d14d92b0d60001b7c38ceadb70c49126454e1e8b88412b9e9d0b69ab53

SandipAgarwalla
Active Contributor
0 Kudos

091f4ad97dfe93487e8db90131a8303ba936661f3ca981f1f1ed5e646f9d6d6b

Ruthiel
Product and Topic Expert
Product and Topic Expert
0 Kudos

9a1cab020899f5076bdf86e60fc3ff16ebee45c394d63e35d49e54638c5e07ae

sanket2221
Explorer
0 Kudos

hi

SyambabuAllu
Contributor
0 Kudos

b27daf3db8529fd681a398af9e5a641f12adbbd49bb8c0caeb4c4d713bcf5e08

tobiasz_h
Active Participant
0 Kudos

f3e0407d45962009a7128f0c2f25c2ce0d8bf7dda7eccfc6cf9b5f5515a19f39

Tomas_Buryanek
Active Contributor
0 Kudos

b1c5c48925af5186fd2ec2431661a205239fec2b7b2fb0e5bc2128287b4fb9c1

-- Tomas --

0 Kudos

Two doubts:

  • My community ID (I used Community Groups username)
  • Signature in reply will not break automatic validation?

Thank you for the challenge! 🙂

-- Tomas --

Thanks for checking, @Tomas_Buryanek ! I did double-check when I saw what looked like a signature on your post (and @thomas_jung has one on his reply to task 0). But the platform only uses that when the UI is rendered, it does not form part of the body of the reply 👍

qmacro_0-1691076364748.png

And yes, Tomas_Buryanek is your ID to use here 👍

Just to reassure you, also:

# developer-challenge-apis (main +=); ./runcheck 1 | grep Tomas
OK Tomas_Buryanek

🙂 

UweFetzer_se38
Active Contributor

8a0e3e68bbae2c48a1f184b0520c7aff75de7a396d9a1d1d4e5b224f199e2610

nex
Explorer
0 Kudos

5684ed0d241619a91220941d58676db2ff943f4250579f7d20e759f28a1b25fe

ajay_soreng
Developer Advocate
Developer Advocate
0 Kudos

83d7917e602682f11bba6d39f1f64d6abcca5dba27a47be8b2b8dd76ddc0a611

VenugopalA
Explorer
0 Kudos

c73f7c84c08796a400964d2641b24120e538eab527a97537be87070362600544

Eurey
Discoverer
0 Kudos

a3b8f9c2c2507b14ad5ed559f0d2c13f395ead36b182c35f3a5d2541bf7dce24

turanaydin
Explorer
0 Kudos

adc144da8dae21282f9fa50d70c04537e2207482af711e0ea7cd373e94d0ea42

qmacro
Developer Advocate
Developer Advocate

🚨Hey folks, in case you wanted to know, a very large majority of you got this task spot on. But that means there are some that didn't quite manage it! I won't give away who is struggling, but wanted to suggest you might want to double check your process and your resulting hash. 

Here's the way the results currently stand, successful (🙂) vs unsuccessful (🙃) :

; ./runcheck 0 | ./summariseresults 
{
  "🙁": "13%",
  "🙂": "87%"
}