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
40,400

(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.

251 REPLIES 251

0 Kudos
16,172

ddbe6cf586750bd227d750fa4261fd0ec381039849864459de3bbc6b5b387f2a

0 Kudos
14,325

well done for being the first to complete this task! 🙂

Dan_Wroblewski
Developer Advocate
Developer Advocate
0 Kudos
15,908

e1f552466cf276f6bdb262d1167918afebd021dbce544cfb7c428be37d6900fd




--------------
See all my blogs and connect with me on Twitter / LinkedIn

eshrinivasan
Developer Advocate
Developer Advocate
0 Kudos
15,902
66b718fd5dfb4e20517fe9f97808416225905433f74b292f9cb936e0ea1663f4

Bharathi_S
Explorer
0 Kudos
15,889

4ad820372d02c26cf55d507f8a9e1aba218d0be65da210ece5c60aa2258bdfa3

vladimirs_semikins
Active Contributor
15,858

a5cca2ea7bffdaf6fd10502c54a052187cfc3fd8ea5f1d0f4a5f6715fabd87be

StKollos
Explorer
0 Kudos
15,846

182b4e640c32dd01b5f1d030ae35272043bd49bbe8a2b5afd83148c7747cd311

Zakir_hussain
Explorer
0 Kudos
15,843

90276098aa06217494f948e4b3f47911d052f535273ae716d511ebc839251dcd

gphadnis2000
Participant
0 Kudos
15,782

83cb01391e3de360b52377769e92f835a4c66156a0d5b40630764477e8c9dc5b

sandeepmalhotra
Participant
0 Kudos
15,773

1f1f1195df1893494ae38fa39a0a0b503cffe191b8381a0dee33ac703b54aee6

abdullahgunes
Participant
0 Kudos
15,775

3dbf765290592a7fd94a06fdb550790d04edde16299de1683815832b0b921dfc

_Konstantin_
Participant
0 Kudos
15,776

b93966f4194b9c1713ac31a9b267ef071035494ff83d9633dbe5953719cd6020

prachetas
Participant
0 Kudos
15,777

8605d22cfa31f083e5ff41ceefead6d8bd27c1b4d9112e56c7686f616a5e1206

Ramjee_korada
Active Contributor
0 Kudos
15,754

3240ee041db84cb07f8971b46fd7a600601bf9f96f11c786221613154f44b9db

cguttikonda24
Participant
0 Kudos
15,731

62a84ff96ebcc74ddf93c42a76c2262660542f3c3fa4ee4837fd9113394039ff

Frank_Haschick
Explorer
0 Kudos
15,731

019f52bd615e9bd71963c4e8a8e22c2520f4d01b7b8c3fc870333cb73337dba5

kumarniti4
Product and Topic Expert
Product and Topic Expert
0 Kudos
15,540

b7de3b7775a6193152c5d89e0fe0c14d8e23cac746aac61e0a3ad08b18391f28

ceedee666
Active Contributor
0 Kudos
15,531

2d1894982838eb9fab584c5d19e5e9444366cf97e3da2609aafcc1b597eb1a9a

koehntopp
Product and Topic Expert
Product and Topic Expert
0 Kudos
15,511
6a98248a2a7edfa160136f704c3c768facff3fc974d974a42ff75ec6ab8903c8

qmacro
Developer Advocate
Developer Advocate
0 Kudos
15,502

there's no requirement to format, btw (in case you did it explicitly).

pmwilliam
Discoverer
0 Kudos
15,510
2d648fca653a53c40b3a8363b9fd52d810aceac09f94430b01c0bbdf1756bcc4

qmacro
Developer Advocate
Developer Advocate
15,503

there's no requirement to format, btw (in case you did it explicitly).

se71
Participant
0 Kudos
15,490

2ebddaec472ab0fd06e61b7077cb8b46abb844e122fb1a3c1b86eb01c505b262

qmacro
Developer Advocate
Developer Advocate
0 Kudos
15,490

Well done to everyone who has taken part so far, and thank you! With the exception of two people, everyone has achieved and shared the correct hash for their combination of SAP Community ID and the static value given.

To those two people (so far) - whom I won't name - just double check you followed the task description precisely* 🙂

*and I'm not referring to any formatting stuff, btw. Rather the value sent to the hash function.

Nacho_Rodriguez
Newcomer
0 Kudos
15,451

75f4f83274de5a468cf1e8db784d3b918d5308881db936c18e900b52030b9ff1

Gowtham
Contributor
0 Kudos
15,431

8daf5b71e651a840de9d35ac5978be7a00b126ec584016e2f9be27a69307cfe7

PriyankaChak
Active Contributor
0 Kudos
15,420

9bd57d25c2e073ff49041c3cd0b1a08987748e776e2a209f969774f5eccfc5c7

prashil
Product and Topic Expert
Product and Topic Expert
0 Kudos
15,405

92215437af8cfbae6b306cfdd95bc54eb9acdc1361a19fd98e26ada8571803d2

ajos
Explorer
0 Kudos
15,395

a6a97b9c6cab24b5e899747bb15e4f9f6b7718fde62c310c997bb9ef225fb7c8

imancour
Explorer
0 Kudos
15,357

24d519a7d6979fe25f0172e83fcc1e1305c976b8d489716556ccc440d43c0c5d

MioYasutake
Active Contributor
0 Kudos
15,355

af72d494a5bb7e795bab8f154819c7f3688a03c8e01ff5408e74c5f8c8396f78

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos
15,350

ae7fe8c17437b5938c5b43854d443d4ce6bde80a761318de8982849b2911a4de

stickman_0x00
Participant
0 Kudos
15,334

27f7a9db0d1561bc540ef26a61ce4deaff9fdd2d87f3e33e996d63254d091ea4

msoans
Explorer
0 Kudos
15,315

6156abf712c96868a725c4814e0373fe859786b832941bae6ca75d7ecddc4db7

Nigel_James
Active Contributor
0 Kudos
15,308

419c43b51e28d13c1c43a251adaca475424cb2fd258001c8138519477463078c

Ritik
Participant
0 Kudos
15,300

24cf6f778f5b0354b2f56a561117f130cb225c09b4352e78694061570344ac27

choujiacheng
Explorer
0 Kudos
15,300

7754c2d5a34f6467ddc5430b90a7152139cf020b499793e5f2532341a740eef8

dhegde
Participant
0 Kudos
15,277

edb75bbfa7ab7c1f32371f15781fb4168e2f30a97ffc0fe9eee75d841fda5bb0

ThienPHAM
Participant
0 Kudos
15,217

65666df823954af9f0b1d85d0c69130957f882a796fa453585a41c56e5052990