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.

246 REPLIES 246

Nicolas
Active Contributor
0 Kudos

938f90aa796b3045767f12ba7d0eb00874b0a4b8fc611a64867d29a56acba3cd

tly
Explorer
0 Kudos

e6d84a759771be186a656ca06c6b40bda99fee051d8ad93fad08293cf89f7789

steph_senita
Explorer
0 Kudos

6208fc07111d487e6b26361388b0aea5517515bb2553c89292ce2ea6f8ca2e93

jmuiruri
Product and Topic Expert
Product and Topic Expert
0 Kudos

b91713a56da8080f49c6acfeb6d67a517b2056f8785ca37177fe08050eaef494

eddiedu
Advisor
Advisor
0 Kudos

4b3b419d0da5c5ed4211865daa43c77cff58536f4b01014e962211643ecd8f8c

nalin_sharma
Advisor
Advisor
0 Kudos

54a7aaff1579694b8a9789ea057065219a4ee402722361a805bd1f08f5c3f90a

ktrkanjec
Discoverer
0 Kudos

2a7fa2097cbd18119c8877c83bf1f39094b61392ae4915b8950dd9455ac3e3f6

bmsudhakaran
Participant
0 Kudos

50341128f4903c345bbfb731e7ec6144c19a3e7345087390c637d8d27193e9fb

VinitaSangtani
Discoverer
0 Kudos

eb2fee216944cb81537ad5c61528428f117a5446141025dad6fa0c430e913f0b

jagadish
Explorer
0 Kudos

b53f980b15769e4c0a88ec34ded570d1d4c2564ef9e4084f7766e51269d9e901

ec1
Active Participant
0 Kudos

35b5a33ac47a2aaa1ffc6170f498bdb93b2c1633af3dc96b468f943f8bf8a101

salilmehta01
Associate
Associate
0 Kudos

447ba1bf1370baf23db358fe4ff990d4937111ae3508ab09bbadaf66fc7e0301

Keekee
Explorer
0 Kudos

b89b530a39442eb42e985dc02cde5fa4a76b3be344f1a54c486bb60f812dc047

SyedAllaBakshu
Participant
0 Kudos

84cdcc2ad90f3bba0b1eed0b48038bf9caf68dfcd37298f46e3736ca6fb072b6

RafkeMagic
Active Contributor
0 Kudos

82e949551dc3c0952077a3823480d5336a6e55d7a9d9ab4c1e3fe9da2f742cbc

Hendrik
Active Participant
0 Kudos

182f3d49609f173d79aa4f438b64ae8c41f37fe3901e4fa4f45ebd387c582034

OlH
Newcomer
0 Kudos

0a5b9781fc66721c97b5f2ed4936416e54414346dce160b19b570b31ddd0885b

Patrick_vN
Active Contributor

1ce9c85ff6d6458b8124c10b9f512b59831ec0c053f95c2ed1cadc09278d0f6b

johna69
Product and Topic Expert
Product and Topic Expert
0 Kudos

040cc7ca1dbc73fab0350dc28a047b5d649995cbd082711085b6d9f4b0cb3918

ArindamSAP
Discoverer
0 Kudos

49e4031384bad9eaffce29560bf8a24f366d5047d0e9a10b1da7d289e793b499

former_member136915
Product and Topic Expert
Product and Topic Expert
0 Kudos
5694e4b78cd079300cb7addfbb70822ae021f13da03bad5277501c1610ca2d52

lehuynhnam
Explorer
0 Kudos

26bba67f22b432a9eef8d08d4dc65c74a61b98acd77b21848c5fe93b6f1bba7c

swanandl
Explorer
0 Kudos

163542efb588b8ee578fba858b274f3f3096635808cb1c2a001714e29b0263c4

Cmdd
Participant
0 Kudos

2a1dd100b9254483ee09e36b5d94156f5bc588d9a6342a82a276d2ba88ae0aa6

naveen1241
Participant
0 Kudos

c804ac81f5f14bdec7407bd0bdccd6c3c69aa5d059e234b4f844c1398f02a6a0

bugsanderrrors
Participant
0 Kudos

722e7d57cb5577f55cdd2c21183bd42cf3c1d134bdff7efe956884d449c59c08

andrew_chiam
Explorer
0 Kudos

fc62e7ab218ad66739a448e1cfe1e40df37ff3eb1845af282db1a764055209ea

Nidhi
Product and Topic Expert
Product and Topic Expert
0 Kudos

e05bd2a25b41cb4a0efef627330539f6d0970d0a7f7fa0e0d5de6ef2964200b5

adrian-ngo
Explorer
0 Kudos

7f4b25ddc5bf5aa7a17ecfc45ec23c130de3c7c5522797f620dcbc1f8475af2d

OlgenH
Participant
0 Kudos

b18538c5ef3436fa48480c59ea876d92a2b9109db5a9aa24ac1909c8bd2ce89d

kunalsahi85
Explorer
0 Kudos

92c883b1fddcfb985f9f5af8ac088d0787876e9fb61e877e008998d642a2bbf7

r5luga
Explorer
0 Kudos

a5774f575b742b4b2eaed4a41519195fb2af30aebff93231513025ddbd1a8c45

p330068
Active Contributor
0 Kudos

cfce8f622e8dfb2ebc245915365db6ce474f661723d1dcca19d09c933e778215

Jagtar
Participant
0 Kudos

439655f436d11f8f82c83c95039b6845ab008b915296096d4ebf92b3d1db9769

JJAIMES
Participant
0 Kudos

599233224b5244df0a1cda28159a7ba6a50c298f871f884fee92b8cc1f6c82a3

FabienHenique
Participant
0 Kudos

03d15d7c9d36c75cbb0dfc84d2371b86a349cd6ee337c7ab0d66885c05ad4017

ALEJONO
Participant
0 Kudos

0bc234fa0d9b0950921348a027b4be5dec51bf0a20bc1dba858920dfce2aecaf

DirkO
Participant
0 Kudos

7f8c9548bdbe070b9d56de5bc7875d8d23ecb5eeb9c9886fcc8b9dff195b46c4

sainithesh21
Active Participant
0 Kudos

7f9a40b35f491c0d7582a10a9bc691239f116d36daa2c2df8b269d134843b705

priyankaG
Participant
0 Kudos

4a9ff0b6ef9484b39d74aa8e0974f2a0c192e672395f123bfe49c21271918fa1